[BUG] otelHeadersHelper script is never executed when Claude Code is launched from PowerShell on Windows
Description
The otelHeadersHelper setting in managed/remote settings does not execute the configured script when Claude Code is launched from PowerShell on Windows. The same configuration works correctly when Claude Code is launched from Git Bash.
Steps to Reproduce
- Configure
otelHeadersHelperin managed settings:
``json``
{
"otelHeadersHelper": "bash ~/.claude/get-otel-token.sh",
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "https://example.com/collector/v1"
}
}
- Create
~/.claude/get-otel-token.shwith a debug log line:
``bash``
#!/usr/bin/env bash
echo "[$(date)] Called" >> "$HOME/.claude/otel-debug.log"
# ... rest of script that outputs {"Authorization":"Bearer <token>"}
- Launch Claude Code from Git Bash →
otel-debug.logis created, script runs, OTEL metrics appear in the backend.
- Launch Claude Code from PowerShell →
otel-debug.logis never created, script never runs, no OTEL metrics are sent.
Expected Behavior
The otelHeadersHelper script should execute regardless of which terminal/shell Claude Code is launched from.
Actual Behavior
The script is never invoked when Claude Code is launched from PowerShell. No error is shown — it fails silently. OTEL metrics are not exported because the exporter has no auth headers.
Verification
- Running
bash ~/.claude/get-otel-token.shmanually from PowerShell works fine and returns valid JSON. - The
bashbinary is in PATH from PowerShell (Git Bash'sbash.exe). - The script, endpoint, credentials, and network connectivity are all confirmed working.
- The only variable is which terminal launches Claude Code.
Environment
- Claude Code version: 2.1.91
- OS: Windows 11 Pro
- PowerShell version: 5.1
- Git Bash: Available and in PATH
- Shell configured in Claude Code: bash
Possibly Related Issues
- #21468 — Plugin SessionStart hook fails on Windows (hook script never executes)
- #22700 — Hook execution uses 'bash' instead of detected full path
- #13013 —
apiKeyHelperpath not expanded on Windows
Workaround
Launch Claude Code from Git Bash instead of PowerShell. This is not ideal for enterprise deployments where users may use different terminals.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗