Skip to content

External: copilot-cli shell tool 'File not found' error provides no diagnostic information #442

@PureWeen

Description

@PureWeen

External: github/copilot-cli

Problem

When the CLI's shell tool (powershell/bash) fails to spawn a shell session, the ConPTY native addon reports:

<exited with error: File not found: >

The string after "File not found:" is empty — no executable name, no PATH searched, no Windows error code. The CLI then retries the same failing operation 5-6 times with no fallback, alternative shell, or additional diagnostics.

This was observed on Windows with copilot CLI 1.0.12-2. The standalone CLI and embedded CLI (via SDK) both exhibited the same behavior. The issue resolved itself after process cleanup, suggesting a transient ConPTY/system state issue — but diagnosing it required decompiling the pkg binary and tracing through minified JS and native conpty.node code.

Suggestions

  1. Include the shell executable name in the error (e.g., File not found: pwsh.exe) — the native conpty.node supports this but receives an empty string
  2. Log the PATH that was searched when shell resolution fails
  3. Try fallback shells (e.g., powershell.exe or cmd.exe if pwsh.exe fails)
  4. Surface the underlying Windows error code from CreateProcessW

Context

  • Windows 11 Enterprise 10.0.26100
  • Copilot CLI 1.0.12-2
  • pwsh.exe was on PATH and functional (pwsh --version worked from terminal)
  • Error affected both standalone copilot -p and SDK-embedded sessions
  • Resolved after killing stale copilot processes and cleaning orphaned lock files in ~/.copilot/pkg/
  • Root cause unknown — could not reproduce on demand

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions