Skip to content

CLI cannot execute hooks shipped with plugins #3659

@brandonh-msft

Description

@brandonh-msft

Describe the bug

As of 1.0.57, I am unable to issue any prompts to GHCP CLI w/o them failing on preToolUse hook exceptions.

Logs show myriad failures like:

2026-06-03T18:51:15.906Z [DEBUG] [hook stderr] The argument '.github/hooks/governance-audit/audit-session-start.ps1' is not recognized as the name of a script file. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
2026-06-03T18:51:15.907Z [DEBUG] [hook stdout] 
Usage: pwsh[.exe] [-Login] [[-File] <filePath> [args]]
                  [-Command { - | <script-block> [-args <arg-array>]
                                | <string> [<CommandParameters>] } ]
                  [-CommandWithArgs <string> [<CommandParameters>]
                  [-ConfigurationName <string>] [-ConfigurationFile <filePath>]
                  [-CustomPipeName <string>] [-EncodedCommand <Base64EncodedCommand>]
                  [-ExecutionPolicy <ExecutionPolicy>] [-InputFormat {Text | XML}]
                  [-Interactive] [-MTA] [-NoExit] [-NoLogo] [-NonInteractive] [-NoProfile]
                  [-NoProfileLoadTime] [-OutputFormat {Text | XML}]
                  [-SettingsFile <filePath>] [-SSHServerMode] [-STA]
                  [-Version] [-WindowStyle <style>]
                  [-WorkingDirectory <directoryPath>]

       pwsh[.exe] -h | -Help | -? | /?

PowerShell Online Help https://aka.ms/powershell-docs

All parameters are case-insensitive.
2026-06-03T18:51:16.068Z [ERROR] Hook execution failed: HookExitCodeError: Hook command failed with code 1

across numerous hook files.

Affected version

1.0.57+

Steps to reproduce the behavior

Install one or more plugins (which ship hooks as part of their functionality) into the CLI.
Send a prompt to the CLI with the plugin active & loaded

Expected behavior

Prompt is processed

Additional context

I have my Copilot Home and cache dirs set to my dev drive (d:\.copilot and d:\.copilot\cache, respectively)

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:platform-windowsWindows-specific: PowerShell, cmd, Git Bash, WSL, Windows Terminalarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions