Direct answer
Test the exact command through the exact shell that Claude Code will invoke, then check the exit code instead of trusting visible output. Community (F027): issue #88256 reports that a statusLine command can fail silently when a Windows path contains spaces and Git Bash is absent because quotes are stripped through powershell -Command. That is a specific user report, not proof that every Windows hook fails. Use a disposable path with spaces, a harmless marker script and a recorded exit status. The win is a reproducible command contract. The loss is that the fact pack provides no universal quoting fix or confirmed fix version. Do not disable a security hook or move production paths into a test to make the symptom disappear.
Why quotes disappear
A Windows command can cross more than one parser. The agent or settings file supplies a command string. A launcher may pass it to PowerShell. PowerShell then parses its own arguments and invokes a script or executable. Quotes that protected a path in one layer do not automatically survive the next layer.
In the reported case, Community (F027): quotes were stripped through powershell -Command when the path contained spaces and Git Bash was absent. The visible symptom was a silent statusLine failure. The report does not establish the exact behavior of every shell, every hook or every Windows installation.
Start by preserving the command as text. Record the setting that launches it, the shell selected for the session and the resolved script path. Replace secrets and production identifiers with labels before sharing the record. Do not copy a live hook configuration into a public issue if it contains private paths or credentials.
Next, separate command construction from execution. Can PowerShell find the script? Can it parse the arguments? Does the script run? Does it return the expected status? A failure at one stage can look like a later stage if the wrapper discards output or ignores the exit code.
Official (F011): hooks can block tool calls, and dependency installs are executable actions. A silent hook failure therefore matters beyond a missing status line. If the hook was meant to enforce a boundary, an apparent success without a verified decision is not evidence that the boundary held. The Claude Code harness security boundary explains why execution controls need their own verification.
Shell behavior
| Shell or layer | Path concern | What to test | Evidence boundary |
|---|---|---|---|
| PowerShell direct invocation | Spaces and native argument passing | Resolve the script with LiteralPath semantics and invoke it directly |
PowerShell behavior still depends on the called executable |
powershell -Command |
Quotes can be reinterpreted before the script runs | Capture the exact command string and resulting arguments | Community: this is the path named in F027 |
| Git Bash | POSIX quoting and path conversion differ from PowerShell | Compare only when Git Bash is actually installed and selected | Its absence matters in the reported case |
| Claude Code setting | The stored command may not match the interactive shell | Run the stored command through the intended launcher | A working manual command does not prove the setting works |
| Hook wrapper | Output and exit status can be lost | Require a marker and a nonzero failure path | A hook is a control, not just a status formatter |
Git Bash versus PowerShell
Git Bash and PowerShell are not interchangeable command interpreters. They handle quoting, environment expansion and executable lookup differently. A command that works in an interactive Git Bash session can fail when Claude Code invokes PowerShell, and the reverse is also possible.
First identify the shell that owns the failing command. Do not install Git Bash solely to make an unrelated PowerShell hook work unless the documented setup and project contract call for it. Official (F024): Windows native support exists, but Windows native lacks sandboxing. That platform boundary is separate from quoting, and it should not be used to explain every command failure.
Compare the same harmless script through both shells only when both are present. Record the exact invocation and exit code for each. Use the same script path, including a disposable directory with spaces. A comparison with different scripts or working directories cannot isolate the parser.
The Linux ARM and headless login guide shows a related troubleshooting order: verify the runtime and launcher before blaming the model. The network storm and NAT retry diagnosis applies the same principle to connection failures. Local command parsing can fail long before a network request exists.
Avoid path assumptions in shared settings. A user profile path, a drive letter and a mounted workspace can differ between machines. Put the stable part of the path in configuration and resolve the variable part in a small wrapper. Then test the wrapper through the same shell. Do not hardcode one developer’s production directory into a team hook.
Official (F028): network variables load once at startup. A similar stale-environment problem can make a corrected command appear broken if the old process keeps running. Restart the client after changing the relevant environment, then repeat the exact test.
Exit codes
Visible output is not a reliable success signal. A command can print an error and still return a code that a wrapper ignores. A hook can also fail before its intended logic runs. Record the exit code from the actual invoked process, not from a later unrelated command.
In PowerShell, $LASTEXITCODE reports the exit code from the last native command or script, depending on how it was invoked. Read it immediately after the command you are testing. If a wrapper runs cleanup or logging afterward, capture the value before that work overwrites it.
Use a harmless probe with two explicit outcomes. The success path writes a marker and exits successfully. The failure path exits with a nonzero status without touching anything important. A wrapper that reports success in both cases is not enforcing the contract you intended.
Do not treat a particular numeric code as universal across tools. The meaningful test is whether the wrapper distinguishes the probe’s success from its failure and whether Claude Code receives the expected decision. Save the observed code in the ticket instead of inventing a standard value.
Official (F015): SDK checkpointing covers Write, Edit and NotebookEdit changes, not Bash commands. A failed hook test can leave shell-side effects that a rewind will not restore. Use a disposable directory and avoid destructive commands in the probe. The rewind and checkpoint limits explain the broader recovery boundary.
Test argument boundaries as well as file existence. A script can be found and still receive the wrong arguments. Give the harmless probe a labeled input and have it write that label to the marker. If the marker contains an unexpected value, the parser changed the argument before the script logic ran.
Separate stdout, stderr and exit status in the record. An error printed to one stream may be invisible in the interface you are watching. Capture both streams without credentials, then associate them with the immediate exit code. This makes a silent wrapper failure distinguishable from a script that ran but returned the wrong result.
Use a failure probe that cannot affect real data. Its purpose is to prove the wrapper notices failure, not to test whether a destructive command works. If the wrapper reports success for the failure probe, stop before connecting the real hook. A status formatter may tolerate that bug; a security control may not.
Failure modes
| Failure mode | Observable symptom | Safe diagnosis | Do not conclude |
|---|---|---|---|
| Path split at spaces | Script not found or wrong argument list | Invoke a disposable spaced path directly | Every spaced path is unsupported |
| Quotes stripped before PowerShell | Command reaches the shell in a different form | Capture the exact command string | The script itself is broken |
| Wrong shell selected | Manual test passes but the hook fails | Run the stored command through its intended shell | Installing another shell is always the fix |
| Exit code ignored | Error text appears without a failed decision | Add a success and failure probe | No output means success |
| Wrapper runs from another directory | Relative paths resolve incorrectly | Set and record the working directory | The drive or filesystem is damaged |
| Stale process environment | Fix works in a new terminal only | Restart the client after the change | The setting is still wrong |
A harmless path probe
Use a temporary directory outside the repository. Give it a name with a space, such as a test folder under the system temp location. Do not use a production workspace, credential directory or real hook target.
Create a small probe script in that directory. Its success path writes a harmless marker and exits successfully. Its failure path exits nonzero without modifying anything else. Keep the script simple enough that a reviewer can inspect every line before execution.
In a direct PowerShell session, resolve the script path and invoke it with the call operator, &, using a quoted path. Read $LASTEXITCODE immediately afterward. This establishes that PowerShell can run the script when the path is passed as intended. It does not yet prove the Claude Code setting uses the same parsing path.
Next, place the same harmless command in a disposable hook or status configuration that mirrors the real setting’s shell and wrapper. Do not enable a production security rule for the test. Trigger the test through the supported interface and record the marker, exit status and Claude Code decision.
If the direct test passes but the configured test fails, compare the command strings and shell selection. If both fail, inspect the script path and permissions. If both pass, restore the original configuration and test one real command at a time with production safeguards still active.
Isolate the probe from project code. A script that imports the repository or reads its configuration can fail for reasons unrelated to quoting. The marker should depend only on the test path and labeled argument, so a reviewer can attribute a failure to the launch chain. Remove the disposable files after recording the result.
The proof-of-work packet is a useful record format. Include the redacted command, shell, resolved path, marker result, exit status and reviewer decision. Avoid terminal recordings that expose private workspace names or tokens.
PATH, working directories and wrappers
A quoted path can still resolve incorrectly when the working directory changes. Relative paths are especially fragile because the same text names different files from different directories. Prefer an explicit, reviewed path or a wrapper that resolves its own location.
Use Get-Item -LiteralPath when inspecting a path that may contain wildcard characters. -LiteralPath tells PowerShell to treat the value as a literal path rather than a pattern. That is a parsing aid, not a substitute for testing the outer launcher.
Check the executable that a wrapper calls. A .cmd file, a PowerShell script and a native executable can have different argument rules. If the wrapper invokes another shell, record that layer too. Each extra layer is another place where quotes can change meaning.
Avoid broad wildcards in cleanup steps. A test wrapper that removes everything in a temporary parent directory is not a harmless probe. Limit the test to its named disposable folder and verify the resolved path before any deletion. The gitignored-file deletion risks explain how local files can be less protected than their names suggest.
Official (F008): best practices recommend naming files, describing symptoms and defining success. Apply that to a hook fix. Name the setting, the expected marker, the permitted shell and the failure behavior. The overengineering and diff scope guide helps keep a Windows command fix from turning into a repository-wide rewrite.
For a shared hook, define the contract before choosing quoting. State which shell is supported, where the wrapper lives, which account runs it and what constitutes success. Put that contract beside the command so a future contributor does not replace it with a personal shell habit.
Inspect the wrapper’s input handling. If it accepts a path from Claude Code, treat that value as data and validate it before use. Do not build a command by concatenating unchecked text into a shell string. A small wrapper with explicit arguments is easier to test than a long nested command, although the wrapper still needs the same end-to-end probe.
Restrict permissions to the files and tools the hook account needs. If a quoting fix proposes running as administrator, stop and ask why. Administrator access does not repair parsing and can make a mistaken path much more damaging.
Version the wrapper with the project so a change is reviewable. Include the harmless probe and its expected marker in the same change. A reviewer should be able to reproduce the result on Windows without access to production paths or credentials. The Claude Code proof-of-work packet provides a useful evidence format.
Practical response: a hook checklist
- Preserve the original. Save the redacted setting and exact command before editing it.
- Identify the shell. Record whether the setting uses PowerShell, Git Bash or another launcher.
- Resolve the path. Confirm the script exists at the intended literal path under the service account.
- Use a disposable folder. Include a space in the test path and keep all test files outside production data.
- Test direct execution. Invoke the probe in PowerShell and capture
$LASTEXITCODEimmediately. - Test failure handling. Confirm that a nonzero probe result produces the intended wrapper decision.
- Test the configured path. Run the same harmless command through the actual Claude Code setting or hook interface.
- Compare one variable. Change quoting, shell or wrapper design separately so the result is explainable.
- Restart after environment changes. Ensure the client reads the new startup configuration.
- Review permissions. A security hook should fail closed according to its documented contract, not silently disappear. The Claude Code permissions reference is the external source for the control model.
- Inspect plugins. A plugin can change commands, hooks, MCP servers and skills. The plugin security audit covers exact-version review.
- Keep a rollback. Restore the prior command if the new wrapper cannot prove both success and failure behavior.
Escalate when the direct probe passes but the configured path still fails. Give the maintainer the exact shell, redacted command, resolved path, marker result and exit status. Include whether Git Bash is present because that condition matters in the reported case. Do not send only a screenshot of the missing status line.
A useful escalation also names what you already ruled out. State that the script runs directly in PowerShell, that the disposable path contains a space and that the wrapper ignores the probe’s nonzero result. Those facts narrow the search without claiming a cause you have not proved.
When the configured path works, test the original command with production safeguards active. Change one setting at a time and keep the rollback ready. If the real command fails again, compare its arguments and working directory with the probe rather than assuming the quoting fix was incomplete.
Official (F016, F017): repository content and tool output remain untrusted even when a hook parses correctly. The repository prompt-injection guide explains how project files can carry instructions. The MCP trust-boundary guide explains why an authenticated server’s output still needs containment.
Official (F020): settings expose transcript and telemetry controls, but they do not establish zero logging. A quoting investigation can place full command lines into logs. Review the secrets in logs and transcripts guide before sharing a trace, and check the settings-file secret exposure guide before moving credentials into a wrapper.
Test checklist
| Test | Expected artifact | Pass condition | Production safeguard |
|---|---|---|---|
| Direct PowerShell invocation | Marker and immediate exit-code record | The spaced path resolves and the probe runs | Use only the disposable folder |
| Failure probe | Nonzero result and wrapper decision | Failure is not reported as success | No destructive target is referenced |
| Configured hook path | Redacted setting and trigger result | The intended shell reaches the same probe | Keep the real security rule disabled during the test |
| Restart check | Same probe after client restart | Startup environment is current | Restore the original configuration afterward |
| Rollback check | Prior command and owner approval | Previous behavior can be restored | Do not overwrite the only working copy |
Keep a short change record with the final wrapper. Include the supported shell, the reason for the wrapper, the probe result and the rollback owner. This helps the next Windows developer understand why a seemingly simple command has an extra layer. It also prevents someone from removing the wrapper because the interactive shell happens to work.
Honest loss and data gaps
The central gap is scope. Issue #88256 describes a statusLine quoting failure under specific conditions. It does not prove that all Windows hooks fail, that Git Bash is required everywhere or that one quoting pattern fixes every launcher. Keep the report’s conditions attached to the claim.
The second gap is the fix version. The fact pack provides no confirmed version that resolves the report. Record the installed Claude Code version, Windows shell, Git Bash availability and exact command before escalating. A future official fix can then be compared with the same harmless probe.
The third gap is prevalence. There is no measured failure rate for spaced Windows paths in this fact pack. A team can show that its configured hook now distinguishes success from failure. It cannot convert that result into a universal product statistic.
Finally, parsing success does not prove a hook is safe or correct. Official (F011, F019): hooks and plugins are executable configuration. Review what the command does, which files it can reach and what happens on failure. The dependency-install side-effects guide applies the same review discipline to package scripts. If a hook changes a database, separate generation from privileged apply using the database migration safety workflow.
Practical alternative for OpenAI-format agents
One AI API Key can be tested from a separate OpenAI-format agent when you want to compare command execution without changing Claude Code’s Windows hook configuration. On 2026-11-27, the 46 live free model IDs were OpenAI-format only. The active route is an OpenAI-format agent such as OpenCode, Cline or Cursor using the documented base URL and one selected free ID. The quickstart covers endpoint setup.
Do not put those free IDs into Claude Code. First-party (F047, F048): Claude Code uses the Anthropic-format endpoint, and all four Claude IDs were marked unavailable on 2026-11-27. The coding-agent compatibility notes explain the distinction. Another agent’s success does not prove that the original PowerShell setting is correct.
The free lane shares 100 requests and 5,000,000 tokens per day per account, resetting at 05:30 IST or 00:00 UTC. Accounts can have up to three keys, with one request in flight per key on free models. New accounts receive $10 credit without a card, and billing is prepaid with no subscription or seat fee. Review pricing, per-key controls and the privacy policy before sending project data. The console keys and usage guide helps with key scope, and account creation is optional.
FAQ
Do all Claude Code hooks fail on Windows?
No. Community (F027): issue #88256 reports a statusLine command failing silently under specific quoting conditions when a path contained spaces and Git Bash was absent. It does not establish a universal Windows hook defect.
Should I install Git Bash to fix every spaced path?
No. First identify the shell that invokes the command and test the exact stored command through it. Git Bash was part of the reported condition, but the fact pack does not make it a universal requirement or fix.
Why can a hook fail without visible output?
A launcher can lose the command, a script can fail before writing output, or a wrapper can ignore the result. Capture the exact command, resolved path, marker and immediate exit status. Visible output alone is not a success contract.
Can I test with a production path if I do not run the command?
Use a disposable path instead. A test should not depend on production files, credentials or a live hook target. A harmless folder with a space and a marker script provides the parsing evidence you need.
Does a working hook prove the command is safe?
No. Official (F011, F019): hooks and plugins are executable configuration. Parsing and exit-code tests prove part of the command contract. Review permissions, side effects and failure behavior separately.
Sources
- Community issue #88256 on statusLine quoting and silent failure
- Anthropic’s Claude Code setup and Windows platform support
- Anthropic’s Claude Code settings reference
- Anthropic’s Claude Code hooks reference
- Anthropic’s Claude Code permissions reference
- Anthropic’s Claude Code network configuration reference