Crash Report: Bash syntax (=) leaking into PowerShell execution causes CommandNotFoundException #8061

Closed
opened 2026-02-16 18:09:03 -05:00 by yindo · 2 comments
Owner

Originally created by @DaveW001 on GitHub (Jan 30, 2026).

Originally assigned to: @rekram1-node on GitHub.

GitHub Issue Draft: PowerShell Syntax Crash

Title

Crash Report: Bash syntax (=) leaking into PowerShell execution causes CommandNotFoundException

Body

Description

The OpenCode agent crashed while attempting to execute a command in a Windows environment using the default shell (PowerShell). The error indicates that a Bash-style variable assignment or command syntax containing = was passed directly to PowerShell, which interpreted = as a command name or argument it couldn't handle in that context.

Error Log

+ FullyQualifiedErrorId : CommandNotFoundException

= : The term '=' is not recognized as the name of a cmdlet, function, script file, or operable
program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.

Environment

  • Platform: Windows (win32)
  • Shell: PowerShell (implied by error format)
  • Agent: 01-Planner (likely executing a Bash tool call)
  • Date: 2026-01-30

Reproduction Context

The agent was likely attempting to run a command that works in Bash but fails in PowerShell.
Possible triggers:

  1. Variable assignment: VAR=value command (Common in Bash, invalid in PowerShell)
  2. Command chaining with specific syntax.
  3. Attempting to use > or 2> redirection which resulted in the creation of a literal file named nul in the working directory (observed in file system artifacts).

Artifacts Observed

  • A file named nul was created in the root directory C:\development\marketing\. In Windows cmd/PowerShell, > /dev/null or incorrect redirection handling can sometimes result in writing to a file named nul if the driver isn't handled correctly or if it's quoted as a string.

Expected Behavior

The system should either:

  1. Detect the Windows environment and use cmd or powershell compatible syntax.
  2. Wrap Bash commands in wsl or bash.exe if a true Bash environment is expected.
  3. Sanitize inputs to prevent shell-specific syntax collisions.

Suggested Fix

Review the command execution layer in opencode-windows-x64. Ensure that when the Bash tool is called on Windows:

  • It actually routes to a bash.exe instance (Git Bash or WSL).
  • OR, if it falls back to PowerShell, it validates that the command syntax is compatible.
Originally created by @DaveW001 on GitHub (Jan 30, 2026). Originally assigned to: @rekram1-node on GitHub. # GitHub Issue Draft: PowerShell Syntax Crash ## Title Crash Report: Bash syntax (`=`) leaking into PowerShell execution causes CommandNotFoundException ## Body ### Description The OpenCode agent crashed while attempting to execute a command in a Windows environment using the default shell (PowerShell). The error indicates that a Bash-style variable assignment or command syntax containing `=` was passed directly to PowerShell, which interpreted `=` as a command name or argument it couldn't handle in that context. ### Error Log ```text + FullyQualifiedErrorId : CommandNotFoundException = : The term '=' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. ``` ### Environment - **Platform:** Windows (win32) - **Shell:** PowerShell (implied by error format) - **Agent:** 01-Planner (likely executing a `Bash` tool call) - **Date:** 2026-01-30 ### Reproduction Context The agent was likely attempting to run a command that works in Bash but fails in PowerShell. Possible triggers: 1. Variable assignment: `VAR=value command` (Common in Bash, invalid in PowerShell) 2. Command chaining with specific syntax. 3. Attempting to use `>` or `2>` redirection which resulted in the creation of a literal file named `nul` in the working directory (observed in file system artifacts). ### Artifacts Observed - A file named `nul` was created in the root directory `C:\development\marketing\`. In Windows `cmd/PowerShell`, `> /dev/null` or incorrect redirection handling can sometimes result in writing to a file named `nul` if the driver isn't handled correctly or if it's quoted as a string. ### Expected Behavior The system should either: 1. Detect the Windows environment and use `cmd` or `powershell` compatible syntax. 2. Wrap Bash commands in `wsl` or `bash.exe` if a true Bash environment is expected. 3. Sanitize inputs to prevent shell-specific syntax collisions. ### Suggested Fix Review the command execution layer in `opencode-windows-x64`. Ensure that when the `Bash` tool is called on Windows: - It actually routes to a `bash.exe` instance (Git Bash or WSL). - OR, if it falls back to PowerShell, it validates that the command syntax is compatible.
yindo added the windows label 2026-02-16 18:09:03 -05:00
yindo closed this issue 2026-02-16 18:09:03 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 30, 2026):

This issue might be a duplicate of existing issues. Please check:

  • #11288: Execute git operations using cmd /c on windows fails (same Bash syntax leaking into Windows shell)
  • #11043: Segfault on Windows git bash (msys) when using bash tool with cwd (Windows shell compatibility issue)
  • #11044: Glob tool fails on Windows MSYS systems / git bash (Windows + MSYS path compatibility)
  • #11042: External directory permission does not work on Windows (Windows path handling affecting command execution)
  • #10871: Windows: Git Bash auto-detection derives invalid bash.exe path (Shell initialization on Windows)
  • #10872: bash tool: external_directory prompt skipped when realpath is missing (Path resolution on Windows)
  • #10829: Windows TUI copy fails: 'Executable not found in $PATH: "powershell.exe"' (PowerShell execution failures)

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Jan 30, 2026): This issue might be a duplicate of existing issues. Please check: - #11288: Execute git operations using cmd /c on windows fails (same Bash syntax leaking into Windows shell) - #11043: Segfault on Windows git bash (msys) when using bash tool with cwd (Windows shell compatibility issue) - #11044: Glob tool fails on Windows MSYS systems / git bash (Windows + MSYS path compatibility) - #11042: External directory permission does not work on Windows (Windows path handling affecting command execution) - #10871: Windows: Git Bash auto-detection derives invalid bash.exe path (Shell initialization on Windows) - #10872: bash tool: external_directory prompt skipped when realpath is missing (Path resolution on Windows) - #10829: Windows TUI copy fails: 'Executable not found in $PATH: "powershell.exe"' (PowerShell execution failures) Feel free to ignore if none of these address your specific case.
Author
Owner

@DaveW001 commented on GitHub (Jan 30, 2026):

Closing as duplicate of #11288. The underlying issue is Bash syntax ( or declare -x AGENT="1"
declare -x ALLUSERSPROFILE="C:\ProgramData"
declare -x ANTIGRAVITY_CLI_ALIAS="agy"
declare -x APPDATA="C:\Users\DaveWitkin\AppData\Roaming"
declare -x BUNDLED_DEBUGPY_PATH="c:\Users\DaveWitkin\.antigravity\extensions\ms-python.debugpy-2025.18.0-win32-x64\bundled\libs\debugpy"
declare -x CHROME_CRASHPAD_PIPE_NAME="\\.\pipe\crashpad_185720_GDUZSRXPWYZUIVPV"
declare -x COLORTERM="truecolor"
declare -x COMMONPROGRAMFILES="C:\Program Files\Common Files"
declare -x COMPUTERNAME="DWITKIN2025"
declare -x COMSPEC="C:\Windows\system32\cmd.exe"
declare -x ChocolateyInstall="C:\ProgramData\chocolatey"
declare -x ChocolateyLastPathUpdate="134111735990034308"
declare -x CommonProgramW6432="C:\Program Files\Common Files"
declare -x DriverData="C:\Windows\System32\Drivers\DriverData"
declare -x EFC_12832_1592913036="1"
declare -x EXEPATH="C:\Program Files\Git\bin"
declare -x GEMINI_CLI_IDE_AUTH_TOKEN="7d1da24e-b329-419e-a3f4-7bcb88bbbde0"
declare -x GEMINI_CLI_IDE_SERVER_PORT="55774"
declare -x GEMINI_CLI_IDE_WORKSPACE_PATH="c:\development\marketing"
declare -x GIT_ASKPASS="c:\Users\DaveWitkin\AppData\Local\Programs\Antigravity\resources\app\extensions\git\dist\askpass.sh"
declare -x HOME="/c/Users/DaveWitkin"
declare -x HOMEDRIVE="C:"
declare -x HOMEPATH="\Users\DaveWitkin"
declare -x JAVA_HOME="C:\Program Files\Eclipse Adoptium\jdk-21.0.9.10-hotspot\"
declare -x LANG="en_US.UTF-8"
declare -x LOCALAPPDATA="C:\Users\DaveWitkin\AppData\Local"
declare -x LOGONSERVER="\\DWITKIN2025"
declare -x MOZ_PLUGIN_PATH="C:\Program Files (x86)\Foxit Software\Foxit PDF Editor\plugins\"
declare -x MSYSTEM="MINGW64"
declare -x NUMBER_OF_PROCESSORS="22"
declare -x OLDPWD
declare -x OPENCODE="1"
declare -x ORIGINAL_XDG_CURRENT_DESKTOP="undefined"
declare -x OS="Windows_NT"
declare -x OneDrive="C:\Users\DaveWitkin\OneDrive - Packaged Agile"
declare -x OneDriveCommercial="C:\Users\DaveWitkin\OneDrive - Packaged Agile"
declare -x PATH="/mingw64/bin:/usr/bin:/c/Users/DaveWitkin/bin:/c/Users/DaveWitkin/AppData/Local/Programs/Python/Python313:/c/Users/DaveWitkin/AppData/Local/Programs/Python/Python313/Scripts:/c/Program Files/PowerShell/7:/c/Program Files/Eclipse Adoptium/jdk-21.0.9.10-hotspot/bin:/c/Program Files/Eclipse Adoptium/jdk-17.0.17.10-hotspot/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/dotnet:/c/Windows_PCTrans/System32:/c/Windows_PCTrans/SysWOW64:/c/Program Files/nodejs:/cmd:/c/Program Files/gsudo/Current:/c/Program Files/Warp/bin:/c/Program Files (x86)/AOMEI/AOMEI Backupper/8.0.0:/c/Program Files/GitHub CLI:/c/Users/DaveWitkin/.cargo/bin:/c/Users/DaveWitkin/AppData/Local/Microsoft/WindowsApps:/c/Users/DaveWitkin/AppData/Roaming/npm:/c/Users/DaveWitkin/AppData/Local/Microsoft/WinGet/Packages/BurntSushi.ripgrep.MSVC_Microsoft.Winget.Source_8wekyb3d8bbwe/ripgrep-15.1.0-x86_64-pc-windows-msvc:/c/Users/DaveWitkin/AppData/Local/Microsoft/WinGet/Packages/OpenAI.Codex_Microsoft.Winget.Source_8wekyb3d8bbwe:/c/Users/DaveWitkin/AppData/Local/Microsoft/WinGet/Packages/Oven-sh.Bun_Microsoft.Winget.Source_8wekyb3d8bbwe/bun-windows-x64:/c/Users/DaveWitkin/.bun/bin:/c/Users/DaveWitkin/AppData/Local/Programs/Antigravity/bin:/c/Program Files/GitHub CLI:/c/Users/DaveWitkin/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/DaveWitkin/.antigravity/extensions/ms-python.debugpy-2025.18.0-win32-x64/bundled/scripts/noConfigScripts:/c/Users/DaveWitkin/.gemini/extensions/splitrail/target/release"
declare -x PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL"
declare -x PLINK_PROTOCOL="ssh"
declare -x PROCESSOR_ARCHITECTURE="AMD64"
declare -x PROCESSOR_IDENTIFIER="Intel64 Family 6 Model 170 Stepping 4, GenuineIntel"
declare -x PROCESSOR_LEVEL="6"
declare -x PROCESSOR_REVISION="aa04"
declare -x PROGRAMFILES="C:\Program Files"
declare -x PROMPT="$P$G"
declare -x PSModulePath="C:\Users\DaveWitkin\OneDrive - Packaged Agile\Documents\PowerShell\Modules;C:\Program Files\PowerShell\Modules;c:\program files\powershell\7\Modules;C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules"
declare -x PUBLIC="C:\Users\Public"
declare -x PWD="/c/development/marketing"
declare -x PYDEVD_DISABLE_FILE_VALIDATION="1"
declare -x PYTHONSTARTUP="c:\Users\DaveWitkin\AppData\Roaming\Antigravity\User\workspaceStorage\90b6e692e9097100af88322ca6cce8b3\ms-python.python\pythonrc.py"
declare -x PYTHON_BASIC_REPL="1"
declare -x ProgramData="C:\ProgramData"
declare -x ProgramW6432="C:\Program Files"
declare -x SESSIONNAME="Console"
declare -x SHLVL="1"
declare -x SYSTEMDRIVE="C:"
declare -x SYSTEMROOT="C:\Windows"
declare -x TEMP="/tmp"
declare -x TERM="xterm-256color"
declare -x TERM_PROGRAM="vscode"
declare -x TERM_PROGRAM_VERSION="1.104.0"
declare -x TMP="/tmp"
declare -x USERDOMAIN="AzureAD"
declare -x USERDOMAIN_ROAMINGPROFILE="AzureAD"
declare -x USERNAME="DaveWitkin"
declare -x USERPROFILE="C:\Users\DaveWitkin"
declare -x VSCODE_DEBUGPY_ADAPTER_ENDPOINTS="c:\Users\DaveWitkin\.antigravity\extensions\ms-python.debugpy-2025.18.0-win32-x64\.noConfigDebugAdapterEndpoints\endpoint-aed848e00a783f5e.txt"
declare -x VSCODE_GIT_ASKPASS_EXTRA_ARGS=""
declare -x VSCODE_GIT_ASKPASS_MAIN="c:\Users\DaveWitkin\AppData\Local\Programs\Antigravity\resources\app\extensions\git\dist\askpass-main.js"
declare -x VSCODE_GIT_ASKPASS_NODE="C:\Users\DaveWitkin\AppData\Local\Programs\Antigravity\Antigravity.exe"
declare -x VSCODE_GIT_IPC_HANDLE="\\.\pipe\vscode-git-b24394abf1-sock"
declare -x VSCODE_INJECTION="1"
declare -x VSCODE_PYTHON_AUTOACTIVATE_GUARD="1"
declare -x WINDIR="C:\Windows"
declare -x ZES_ENABLE_SYSMAN="1") leaking into the Windows native shell (PowerShell/CMD) because the Bash tool failed to locate/use a valid bash executable (likely related to #10871).

@DaveW001 commented on GitHub (Jan 30, 2026): Closing as duplicate of #11288. The underlying issue is Bash syntax ( or declare -x AGENT="1" declare -x ALLUSERSPROFILE="C:\\ProgramData" declare -x ANTIGRAVITY_CLI_ALIAS="agy" declare -x APPDATA="C:\\Users\\DaveWitkin\\AppData\\Roaming" declare -x BUNDLED_DEBUGPY_PATH="c:\\Users\\DaveWitkin\\.antigravity\\extensions\\ms-python.debugpy-2025.18.0-win32-x64\\bundled\\libs\\debugpy" declare -x CHROME_CRASHPAD_PIPE_NAME="\\\\.\\pipe\\crashpad_185720_GDUZSRXPWYZUIVPV" declare -x COLORTERM="truecolor" declare -x COMMONPROGRAMFILES="C:\\Program Files\\Common Files" declare -x COMPUTERNAME="DWITKIN2025" declare -x COMSPEC="C:\\Windows\\system32\\cmd.exe" declare -x ChocolateyInstall="C:\\ProgramData\\chocolatey" declare -x ChocolateyLastPathUpdate="134111735990034308" declare -x CommonProgramW6432="C:\\Program Files\\Common Files" declare -x DriverData="C:\\Windows\\System32\\Drivers\\DriverData" declare -x EFC_12832_1592913036="1" declare -x EXEPATH="C:\\Program Files\\Git\\bin" declare -x GEMINI_CLI_IDE_AUTH_TOKEN="7d1da24e-b329-419e-a3f4-7bcb88bbbde0" declare -x GEMINI_CLI_IDE_SERVER_PORT="55774" declare -x GEMINI_CLI_IDE_WORKSPACE_PATH="c:\\development\\marketing" declare -x GIT_ASKPASS="c:\\Users\\DaveWitkin\\AppData\\Local\\Programs\\Antigravity\\resources\\app\\extensions\\git\\dist\\askpass.sh" declare -x HOME="/c/Users/DaveWitkin" declare -x HOMEDRIVE="C:" declare -x HOMEPATH="\\Users\\DaveWitkin" declare -x JAVA_HOME="C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.9.10-hotspot\\" declare -x LANG="en_US.UTF-8" declare -x LOCALAPPDATA="C:\\Users\\DaveWitkin\\AppData\\Local" declare -x LOGONSERVER="\\\\DWITKIN2025" declare -x MOZ_PLUGIN_PATH="C:\\Program Files (x86)\\Foxit Software\\Foxit PDF Editor\\plugins\\" declare -x MSYSTEM="MINGW64" declare -x NUMBER_OF_PROCESSORS="22" declare -x OLDPWD declare -x OPENCODE="1" declare -x ORIGINAL_XDG_CURRENT_DESKTOP="undefined" declare -x OS="Windows_NT" declare -x OneDrive="C:\\Users\\DaveWitkin\\OneDrive - Packaged Agile" declare -x OneDriveCommercial="C:\\Users\\DaveWitkin\\OneDrive - Packaged Agile" declare -x PATH="/mingw64/bin:/usr/bin:/c/Users/DaveWitkin/bin:/c/Users/DaveWitkin/AppData/Local/Programs/Python/Python313:/c/Users/DaveWitkin/AppData/Local/Programs/Python/Python313/Scripts:/c/Program Files/PowerShell/7:/c/Program Files/Eclipse Adoptium/jdk-21.0.9.10-hotspot/bin:/c/Program Files/Eclipse Adoptium/jdk-17.0.17.10-hotspot/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Windows/System32/OpenSSH:/c/Program Files/dotnet:/c/Windows_PCTrans/System32:/c/Windows_PCTrans/SysWOW64:/c/Program Files/nodejs:/cmd:/c/Program Files/gsudo/Current:/c/Program Files/Warp/bin:/c/Program Files (x86)/AOMEI/AOMEI Backupper/8.0.0:/c/Program Files/GitHub CLI:/c/Users/DaveWitkin/.cargo/bin:/c/Users/DaveWitkin/AppData/Local/Microsoft/WindowsApps:/c/Users/DaveWitkin/AppData/Roaming/npm:/c/Users/DaveWitkin/AppData/Local/Microsoft/WinGet/Packages/BurntSushi.ripgrep.MSVC_Microsoft.Winget.Source_8wekyb3d8bbwe/ripgrep-15.1.0-x86_64-pc-windows-msvc:/c/Users/DaveWitkin/AppData/Local/Microsoft/WinGet/Packages/OpenAI.Codex_Microsoft.Winget.Source_8wekyb3d8bbwe:/c/Users/DaveWitkin/AppData/Local/Microsoft/WinGet/Packages/Oven-sh.Bun_Microsoft.Winget.Source_8wekyb3d8bbwe/bun-windows-x64:/c/Users/DaveWitkin/.bun/bin:/c/Users/DaveWitkin/AppData/Local/Programs/Antigravity/bin:/c/Program Files/GitHub CLI:/c/Users/DaveWitkin/AppData/Local/Programs/Microsoft VS Code/bin:/c/Users/DaveWitkin/.antigravity/extensions/ms-python.debugpy-2025.18.0-win32-x64/bundled/scripts/noConfigScripts:/c/Users/DaveWitkin/.gemini/extensions/splitrail/target/release" declare -x PATHEXT=".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.CPL" declare -x PLINK_PROTOCOL="ssh" declare -x PROCESSOR_ARCHITECTURE="AMD64" declare -x PROCESSOR_IDENTIFIER="Intel64 Family 6 Model 170 Stepping 4, GenuineIntel" declare -x PROCESSOR_LEVEL="6" declare -x PROCESSOR_REVISION="aa04" declare -x PROGRAMFILES="C:\\Program Files" declare -x PROMPT="\$P\$G" declare -x PSModulePath="C:\\Users\\DaveWitkin\\OneDrive - Packaged Agile\\Documents\\PowerShell\\Modules;C:\\Program Files\\PowerShell\\Modules;c:\\program files\\powershell\\7\\Modules;C:\\Program Files\\WindowsPowerShell\\Modules;C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\Modules" declare -x PUBLIC="C:\\Users\\Public" declare -x PWD="/c/development/marketing" declare -x PYDEVD_DISABLE_FILE_VALIDATION="1" declare -x PYTHONSTARTUP="c:\\Users\\DaveWitkin\\AppData\\Roaming\\Antigravity\\User\\workspaceStorage\\90b6e692e9097100af88322ca6cce8b3\\ms-python.python\\pythonrc.py" declare -x PYTHON_BASIC_REPL="1" declare -x ProgramData="C:\\ProgramData" declare -x ProgramW6432="C:\\Program Files" declare -x SESSIONNAME="Console" declare -x SHLVL="1" declare -x SYSTEMDRIVE="C:" declare -x SYSTEMROOT="C:\\Windows" declare -x TEMP="/tmp" declare -x TERM="xterm-256color" declare -x TERM_PROGRAM="vscode" declare -x TERM_PROGRAM_VERSION="1.104.0" declare -x TMP="/tmp" declare -x USERDOMAIN="AzureAD" declare -x USERDOMAIN_ROAMINGPROFILE="AzureAD" declare -x USERNAME="DaveWitkin" declare -x USERPROFILE="C:\\Users\\DaveWitkin" declare -x VSCODE_DEBUGPY_ADAPTER_ENDPOINTS="c:\\Users\\DaveWitkin\\.antigravity\\extensions\\ms-python.debugpy-2025.18.0-win32-x64\\.noConfigDebugAdapterEndpoints\\endpoint-aed848e00a783f5e.txt" declare -x VSCODE_GIT_ASKPASS_EXTRA_ARGS="" declare -x VSCODE_GIT_ASKPASS_MAIN="c:\\Users\\DaveWitkin\\AppData\\Local\\Programs\\Antigravity\\resources\\app\\extensions\\git\\dist\\askpass-main.js" declare -x VSCODE_GIT_ASKPASS_NODE="C:\\Users\\DaveWitkin\\AppData\\Local\\Programs\\Antigravity\\Antigravity.exe" declare -x VSCODE_GIT_IPC_HANDLE="\\\\.\\pipe\\vscode-git-b24394abf1-sock" declare -x VSCODE_INJECTION="1" declare -x VSCODE_PYTHON_AUTOACTIVATE_GUARD="1" declare -x WINDIR="C:\\Windows" declare -x ZES_ENABLE_SYSMAN="1") leaking into the Windows native shell (PowerShell/CMD) because the Bash tool failed to locate/use a valid bash executable (likely related to #10871).
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8061