Skip to content

Windows TUI copy fails: Executable not found in $PATH: "powershell.exe" (installed via Bun) #10829

Closed

Description

@Abdo-Eid

Description

Description

On Windows, copying a selection in the OpenCode TUI fails with:

Executable not found in $PATH: "powershell.exe"

I installed OpenCode via Bun:

bun add -g opencode-ai

PowerShell 7 (pwsh.exe) is installed and is my main shell, but the legacy Windows PowerShell path was removed from PATH. The TUI appears to invoke powershell.exe (likely for Set-Clipboard), so PATH resolution fails even though the file exists on disk.

Why it happens

Many Windows clipboard implementations in CLIs still rely on Windows PowerShell 5.1:

powershell.exe -Command Set-Clipboard ...

If this directory is missing from PATH:

C:\Windows\System32\WindowsPowerShell\v1.0\

then powershell.exe can’t be found, causing the error.

Environment

  • OS: Windows
  • Shell: PowerShell 7 (pwsh)
  • Install: bun add -g opencode-ai
  • Issue: TUI selection copy/clipboard

Checks (commands that worked)

File exists:

Test-Path "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe"

PATH contains the directory:

$env:Path -split ';' | Select-String -SimpleMatch "WindowsPowerShell\v1.0"

Verify resolution (important: where is an alias in PowerShell, so use where.exe):

where.exe powershell

Verify Windows PowerShell runs:

powershell -NoProfile -Command '$PSVersionTable.PSVersion'

Expected output shows PowerShell 5.1.x.

Fix

Add back to System PATH:

C:\Windows\System32\WindowsPowerShell\v1.0\

Restart terminal + restart the TUI.

Suggested improvement

On Windows, fallback order could be:

  1. pwsh.exe
  2. powershell.exe
  3. clip.exe

This avoids clipboard failures on machines that only expose PowerShell 7.

Plugins

No response

OpenCode version

1.1.36

Steps to reproduce

Steps to Reproduce

  1. Use Windows with PowerShell 7 as primary shell
    Install PowerShell 7 and remove the legacy Windows PowerShell path from PATH:

    C:\Windows\System32\WindowsPowerShell\v1.0\
    
  2. Install OpenCode using Bun

    bun add -g opencode-ai
    
  3. Open a new PowerShell terminal

  4. Run OpenCode

    opencode
    
  5. Inside the TUI, select text and trigger copy

  6. Observe error

    Executable not found in $PATH: "powershell.exe"
    

Root condition required

The issue occurs when:

  • powershell.exe exists on disk
  • but its directory is missing from PATH
  • and the TUI attempts to use it for clipboard operations

Screenshot and/or share link

Image

Operating System

Windows 11

Terminal

Windows Terminal

Activity

  1. added
    opentuiThis relates to changes in v1.0, now that opencode uses opentui
    on Jan 27, 2026
  2. github-actions commented on Jan 27, 2026

    @github-actions
    Contributor

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

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingopentuiThis relates to changes in v1.0, now that opencode uses opentuiwindows

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions