Skip to content

CLI not able to run any commands #196

Description

@javiercn

Describe the bug

This is on windows. Whenever I try to make it do anything, it fails to run any command (powershell or CMD)

Below is just an extract of me asking it to describe the project structure for a folder it has access to.

● I'll help you explore the directory structure of the current working directory.

✗ List directory .
   Unhandled error: Error: Command timed out
●

   Let me try using PowerShell to list the directory structure:

✓ List all directories recursively up to 2 levels deep
   $ Get-ChildItem -Path . -Directory -Recurse -Depth 2 | Select-Object FullName
   ↪ 1 line...
✗ read_powershell
   Invalid session ID: main. Please supply a valid session ID to read output from.
●

   Let me try a simpler approach:

✓ List directories in current folder
   $ Get-ChildItem -Directory | Select-Object Name
   ↪ 1 line...
✓ stop_powershell
   ↪ 1 line...
●

   Let me try with a fresh session and simpler command:

✓ List directories
   $ ls -Directory
   ↪ 1 line...
✓ stop_powershell
   ↪ 1 line...
●

   Let me try with tree command:

✗ Show directory tree structure
   $ tree /F /A
   Permission denied and could not request permission from user
●

   Let me try using Get-ChildItem with limited output:

✗ List items in current directory
   $ Get-ChildItem | Format-Table Name, Mode -AutoSize
   Permission denied and could not request permission from user

Affected version

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

Additional context

No response

Activity

  1. added theissue type on Oct 3, 2025
  2. SteveSandersonMS commented on Oct 6, 2025

    @SteveSandersonMS
    Contributor

    @javiercn confirmed that his PowerShell profile emits a lot of extra info by default on startup. I suspect this is confusing the output parser. So I expect we can fix this by passing -NoProfile to pwsh.exe when running shell commands (which is something we should be doing anyway to avoid any other interference).

  3. RyanHecht commented on Oct 6, 2025

    @RyanHecht
    Collaborator

    We've fixed this in 0.0.335!

  4. glenschrader commented on Oct 8, 2025

    @glenschrader

    @RyanHecht I seem to still get this error in version 0.0.336, so not sure it has been resolved

     ✗ Get current branch name
       $ git rev-parse --abbrev-ref HEAD
       <exited with error: PowerShell 6+ (pwsh) is not available. Please install it from https://aka.ms/powershell. Error: Error: Command failed: pwsh.exe --version
       'pwsh.exe' is not recognized as an internal or external command,
       operable program or batch file.
       >
    
    PS C:\> copilot -version
    0.0.336
    Commit: 75151b8
    
  5. SteveSandersonMS commented on Oct 9, 2025

    @SteveSandersonMS
    Contributor

    @glenschrader That's a different thing - as per the message, you do need to install PowerShell (6+), as it's a prerequisite for this tool on Windows.

  6. glenschrader commented on Oct 9, 2025

    @glenschrader

    @SteveSandersonMS thanks, I have to admit I just assumed Windows 11 would have the latest powershell installed (or at least 6).

  7. whirlwin commented on Oct 20, 2025

    @whirlwin

    Still getting the "Permission denied and could not request permission from user" in version 0.0.346. Commit: 74e4d22

  8. myoung34 commented on Oct 21, 2025

    @myoung34

    Im getting this and it's unclear why

    It works in copilot but not copilot -p

    Image
  9. fatihdurgut commented on Nov 17, 2025

    @fatihdurgut

    I'm also getting the similar error even in the Administrator mode.

    Image
  10. mfide commented on Jan 26, 2026

    @mfide

    I have same problem with GitHub Copilot v0.0.395 and I have pwsh.exe --version -> PowerShell 7.5.4 in my system currently installed. Claude cli, Gemini cli and Cursor cli all work fine.

    Something wrong with copilot cli. not just python commands, any powershell or git commands all are failing with the same error message:
    Image

  11. williamomeara commented on Jan 27, 2026

    @williamomeara

    ❯ run pwd

    ✓ Print working directory
    $ pwd
    └ 1 line...

    Read shell output:
    Waiting up to 5 seconds for command output
    Invalid session ID: 0. Please supply a valid session ID to read output from.

    same issue here....

  12. nicola853 commented on Jan 28, 2026

    @nicola853

    My initial command:
    copilot -p "Read SPEC.md and start the project"

    Same problem, message repeated:
    Permission denied and could not request permission from user

    Fixed by adding:
    copilot -p "Read SPEC.md and start the project" --allow-all

  13. ahmadbass3l commented on Feb 13, 2026

    @ahmadbass3l

    I am using GitHub Copilot CLI 0.0.409. on Windows 11 with PowerShell 7.5.4

    I can see that different issues were reported here. To solve the last one from @mfide one has to update powershell on windows at least to version 6 as copilot itself suggested:

    ● The issue is with the environment configuration, not my capabilities.
    
      The powershell tool I have access to is configured to use PowerShell 6+ (pwsh.exe), but this system appears to only have Windows PowerShell 5.1 installed.
    
      Error message (in German):
    
       Error: Command failed: pwsh.exe --version
       Der Befehl "pwsh.exe" ist entweder falsch geschrieben oder
       konnte nicht gefunden werden.
    
      Translation: "The command 'pwsh.exe' is either misspelled or could not be found."
    
      The Problem:
    
       - The CLI tool wrapper expects pwsh.exe (PowerShell Core/6+)
       - Your system doesn't have it installed
       - You likely have Windows PowerShell
        5.1 instead
    
      Solutions:
    
       1. Install PowerShell 6+ from https://aka.ms/powershell (https://aka.ms/powershell)
       2. Or: Use your local terminal directly (PowerShell, CMD, or Git Bash) and run commands yourself - I can provide guidance
    

    nevertheless, this doesn't solve the fact that most shell commands doesn't really work. For instance:

    $ cd ..
    No Content
    

    ls or pwd would work

  14. RedEye-Developers commented on Mar 14, 2026

    @RedEye-Developers

    i also have same issue copilot can't able to access both cmd and pwsh.

  15. RedEye-Developers commented on Mar 14, 2026

    @RedEye-Developers

    @RyanHecht the issue was not fixed.

  16. danparisi commented on May 7, 2026

    @danparisi

    Same for me with latest version
    Permission denied and could not request permission from user

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions