bug: Windows sandbox still fails with os error 203 after #9042, including with system PowerShell
Version: 0.8.4-5172 (Nightly)
Describe the Bug
On Windows, every shell command in Cowork fails before the shell process starts with:
ERROR: sandbox setup failed: could not start C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe inside the sandbox: The system could not find the environment option that was entered. (os error 203) The sandbox could not build an environment for the shell, which is a bug in Jan rather than a problem with the shell's location; please report it with the app logs.
The same error originally occurred with the default Git Bash shell:
C:\Program Files\Git\bin\bash.exe
I then explicitly set:
JAN_AGENT_SHELL=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
The environment variable was confirmed both at User scope and in a new PowerShell process:
[Environment]::GetEnvironmentVariable("JAN_AGENT_SHELL", "User") $env:JAN_AGENT_SHELL
Both returned:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
After fully restarting Jan, Jan correctly attempted to start the system PowerShell executable, but the same os error 203 occurred.
This suggests the issue is not Git Bash permissions or shell discovery. The failure appears to happen while Jan is creating the AppContainer child environment, before the selected shell actually starts.
File tools such as read, write, and edit work normally in the Cowork workspace. The failure appears isolated to shell execution inside the Windows sandbox.
Related issues / fixes:
- #9041
- #9042
- #9044
Steps to Reproduce
- Run Jan Nightly 0.8.4-5172 on Windows x86_64.
- Open Cowork and attach a workspace folder.
- Ask the agent to run any shell command, for example: whoami or: Get-Location
- Observe os error 203.
- Set JAN_AGENT_SHELL to the system PowerShell executable: [Environment]::SetEnvironmentVariable( "JAN_AGENT_SHELL", "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe", "User" )
- Fully close Jan and start it again.
- Run another shell command.
- Jan now attempts to start system PowerShell, but the same os error 203 occurs.
Screenshots / Logs
The error shown by Jan is: ERROR: sandbox setup failed: could not start C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe inside the sandbox: The system could not find the environment option that was entered. (os error 203) The sandbox could not build an environment for the shell, which is a bug in Jan rather than a problem with the shell's location; please report it with the app logs.
Operating System
- MacOS
- Windows
- Linux
Source: janhq/jan