Skip to content

_claude_cli: surface stdout when claude -p fails with empty stderr#17

Merged
thejefflarson merged 1 commit into
mainfrom
fix/surface-claude-stdout-on-error
May 17, 2026
Merged

_claude_cli: surface stdout when claude -p fails with empty stderr#17
thejefflarson merged 1 commit into
mainfrom
fix/surface-claude-stdout-on-error

Conversation

@thejefflarson
Copy link
Copy Markdown
Owner

Summary

`claude -p` writes both its response and its error diagnostics to stdout in `--print` mode. The wrapper was raising `ClaudeCLIError` with just `stderr[:500]`, which produces "claude exited with code 1: " (empty diag) on every failure mode we've seen in CI.

This patch prefers stderr when present, falls back to stdout, and uses "(no output)" when both are empty.

Why

The soundcheck-action self-test has been failing silently on every run with `ERROR: claude exited with code 1:` and an empty trailing message. With this patch the next run will surface whatever `claude -p` is actually printing, which will tell us if it's an auth issue, a model-routing issue, a flag mismatch, or something else.

Test plan

  • `python scripts/validate-skills.py` — 45/45 pass
  • Land + bump soundcheck-action's SOUNDCHECK_SHA, then re-run the action self-test to see the real claude error

🤖 Generated with Claude Code

`claude -p` writes its response (and often its errors) to stdout, not
stderr. The wrapper was raising ClaudeCLIError with just stderr[:500],
which left "claude exited with code 1: " (empty) on every CI failure
mode we've seen — the diagnostic info was being captured and silently
discarded.

Prefer stderr when present, fall back to stdout, and use "(no output)"
when both are empty. Caps the diagnostic at 1KB.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@thejefflarson thejefflarson merged commit 2900616 into main May 17, 2026
8 checks passed
@thejefflarson thejefflarson deleted the fix/surface-claude-stdout-on-error branch May 17, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant