claude-code-action: SDK session returns is_error:true with zero turns/tool calls (subtype:success, 0 cost) — reproduces across v1.0.160 to v1.0.201, with and without --json-schema
Summary
claude-code-action consistently fails since ~2026-08-23 20:47 UTC (still failing as of 2026-08-24): the Claude Agent SDK session returns a result event with is_error: true, num_turns: 1, duration_ms in the 200-280ms range, and total_cost_usd: 0 — with no assistant message, no tool call, and no actual work performed — despite subtype: "success" on the same result object. Reproduced across 3 action versions and 2 models, so this doesn't look like a version-specific regression on our side.
Environment
- Action versions tested:
v1.0.160(2026-06-29),v1.0.199(2026-08-21),v1.0.201(2026-08-23) — all reproduce identically. - Models tested:
claude-sonnet-4-6(production workflow) andclaude-haiku-4-5(isolated repro below) — both affected. - Auth:
anthropic_api_keyinput (direct API key, not OAuth/Bedrock/Vertex). - Trigger: both
pull_requestand manualworkflow_dispatchreproduce it.
Minimal repro
- uses: anthropics/[email protected]
id: probe
continue-on-error: true
with:
anthropic_api_key: ${{ secrets.ANTHROPIC_API_KEY }}
claude_args: |
--max-turns 3
--model claude-haiku-4-5
--allowedTools "Read"
prompt: |
Read README.md, then respond with "OK".
Result event captured from the run log:
{"type": "system", "subtype": "init", "message": "Claude Code initialized", "model": "claude-haiku-4-5"}
{"type": "result", "subtype": "success", "is_error": true, "duration_ms": 220, "num_turns": 1, "total_cost_usd": 0, "permission_denials_count": 0}
No event in between — no assistant turn, no Read tool call, nothing. The SDK goes straight from init to an is_error: true result in ~220ms.
With --json-schema (our production config on gardien.yml)
Adding --json-schema '{"type":"object","properties":{"verdict":{"type":"string","enum":["A","B","C"]}},"required":["verdict"]}' to the same config turns this into a hard action failure:
##[error]--json-schema was provided but Claude did not return structured_output. Result subtype: success
##[error]Action failed with error: --json-schema was provided but Claude did not return structured_output. Result subtype: success
Also worth noting: the action logs Set session_id: <uuid> internally right before this error, but steps.<id>.outputs.session_id is empty afterward — the session_id output isn't populated on this failure path, even though a session_id clearly exists internally.
Impact on our side
We use claude-code-action for 4 automated review/monitoring workflows (PR review bot, an issue-triage bot, a staging/main drift auditor, and an hourly production monitor). All 4 depend on --json-schema + steps.*.outputs.structured_output to turn a review verdict into a pass/fail CI check (rather than parsing free-text comments, which we'd previously found fragile). Since this started, our PR-review bot fails on every single PR with zero real review performed, and we've had to bypass required-status-check protection to keep merging. We initially suspected a version regression (the floating @v1 tag had just moved to a new release with an Agent SDK bump) and pinned to progressively older versions, but the failure reproduces identically all the way back to v1.0.160 (2026-06-29) and with --json-schema removed entirely — so it doesn't look like something we can route around with a version pin.
Question
Is this a known incident (API-side or Agent SDK-side) rather than an action bug? Happy to provide full run logs / workflow files if useful.
Update — a variant of this observed today on a different PR, using the same --json-schema config as the original report (still pinned to v1.0.199).
Run: https://github.com/piro-anthony-stack/monequipe.ia/actions/runs/32726720097 Comment posted by that run: https://github.com/piro-anthony-stack/monequipe.ia/pull/171#issuecomment-5395165526
This run took 5m32s (not the near-instant ~220-280ms failure from the original report) and did post a real, substantive review comment on the PR — readable text addressing the actual diff, referencing specific files/lines. So the underlying Claude session clearly executed the review task correctly.
Despite that, our downstream step read empty values for both outputs:
STRUCTURED_OUTPUT:
REVIEW_SESSION_ID:
REVIEW_OUTCOME: failure
Same as the original report, --json-schema was provided but no structured_output was captured — but this time a full review clearly ran and successfully posted its result via gh pr comment. The only failure is in the structured-output/session_id extraction after the fact, not in the session itself.
This is a different signal from the original report (there, duration_ms: 220-280, is_error: true, zero tool calls, zero assistant turns — nothing happened at all). Here the session did real multi-turn work and produced a valid result; only steps.<id>.outputs.structured_output and .session_id failed to populate. Might point toward an issue in how/when those outputs get set on this failure path, rather than a session-level problem — flagging in case it's a useful data point, no further speculation on the cause from our side.
The two signals in this thread look like different failures, and only one is still live.
Signal 1 — the 220ms is_error:true / num_turns:1 / cost:0 init crash — appears resolved. A downstream consumer bumping v1.0.193 -> v1.0.205 reported it cleared (POWERFULMOVES/PMOVES.AI@8035275), consistent with the Claude Code 2.1.241–2.1.245 bumps in that range rather than anything in the action itself.
Signal 2 — the Aug 24 follow-up, where a 5m32s run did real work and posted a genuine review but returned empty session_id and structured_output — is still present on main.
The session id is read from the system.init message and logged at base-action/src/run-claude-sdk.ts:233, but it is only published as an output by the callers (base-action/src/index.ts:67, src/entrypoints/run.ts:310), after runClaude returns. Every failure path below the extraction throws rather than returns — the is_error check, the maxTurns check, and the --json-schema structured-output check at line 274 — so the caller's setOutput block is skipped entirely and the catch rescues only execution_file via setExecutionFileOutputIfPresent().
That matches the original report exactly:
the action logs
Set session_id: <uuid>internally right before this error, butsteps.<id>.outputs.session_idis empty afterward — the session_id output isn't populated on this failure path, even though a session_id clearly exists internally.
base-action/src/run-claude-sdk.ts is unchanged from v1.0.193 through current main apart from #1608's model-limits logging, which doesn't touch this path — so no version bump has addressed signal 2.
I have a small patch that publishes session_id where it is discovered, giving it the same error-path guarantee execution_file already has. Opening it as a PR shortly. It would not close this issue: the missing structured_output is the separate, still-open question, and there is nothing to publish for it on that path because the SDK never returned it — which is why the code throws in the first place.
Additional data point with an unusually clean elimination table. Repo: private, wp-review + claude-code-review workflows, claude_code_oauth_token auth. Failures began 2026-08-29T03:38Z sharp and reproduce ~100% since (a dozen runs): result JSON is exactly {subtype: success, is_error: true, num_turns: 1, total_cost_usd: 0, modelUsage: {}} ~1.9s after the CLI init line, with NO error text even under ACTIONS_STEP_DEBUG. Everything else is proven identical across the cliff: same action SHA (a874e9ec), same Claude CLI version on both sides (2.1.251, native build — a success at 03:18Z and every failure since ran the same version), same runner image family (successes and failures both on 20260823.283.1), token re-minted mid-window with no change, and a lean reopened PR fails identically to a comment-heavy one, so prompt size is excluded. From our seat this looks server-side or account-state-triggered rather than version-correlated. Happy to provide run IDs privately.
Additional reproduction from another private production repo, with a signature that matches the latest OAuth reports in this thread very closely.
Environment / run:
Auth: claude_code_oauth_token Action: anthropics/claude-code-action/base-action@a874e9ecd7bb36efdad65429c6b35815f5a08f10 Claude Code CLI: 2.1.251 GitHub runner: ubuntu-24.04, image 20260823.283.1 GitHub Actions run: 33287863470
Observed behavior:
Claude Code initializes successfully then returns almost immediately with subtype: success, is_error: true, num_turns: 1, total_cost_usd: 0, permission_denials_count: 0, modelUsage: {} no assistant turn and no tool work occurs with --json-schema, the action then fails with: --json-schema was provided but Claude did not return structured_output. Result subtype: success
This blocks an automated CI/CD agent workflow that depends on structured output. Our transport/security checks all passed before the Claude step, so the failure is isolated to the Claude execution path. We have not rotated secrets speculatively because current evidence does not indicate an OAuth-token problem.
Happy to provide additional run details privately if useful.
Correcting my earlier comment, and adding one finding that I think explains why this thread keeps circling.
Retracting the "signal 1 is resolved" claim
I wrote that the 220ms is_error:true init crash "appears resolved" by the 2.1.241–2.1.245 bumps, citing POWERFULMOVES/PMOVES.AI#2746 (v1.0.193 → v1.0.205). That was wrong, and the source I cited reversed itself the same day.
POWERFULMOVES/PMOVES.AI#2836, merged nine hours after my comment:
The repo already pinned v1.0.205 (SDK 2.1.245) as an attempted fix — failures continued on it.
That repo moved to v1.0.210 / SDK 2.1.251. @johump and @sok-kheang-jewelry then both reported 2.1.251 failing with the same signature. So the versions falsified so far are 2.1.245 and 2.1.251, and I'm not aware of evidence that anything through the current 2.1.258 changes it.
@johump's elimination table is the cleanest data in the thread on this — same action SHA, same CLI 2.1.251, same runner image family on both sides of a sharp 2026-08-29T03:38Z cliff, with a success at 03:18Z. That rules out version correlation in a way my downstream-report inference did not. Signal 1 should be treated as open.
Why nobody in this thread can see an error
@johump noted there is no error text even under ACTIONS_STEP_DEBUG. I think that is a reporting bug in this action, and it is separable from whatever is causing signal 1.
#1496 (merged 2026-07-13) added a diagnostic for exactly this failure shape, at base-action/src/run-claude-sdk.ts:
Claude result reported subtype success with is_error:true (run did not complete successfully)
Execution failed: <resultMessage.errors>
That block is unreachable whenever --json-schema is set. The hasJsonSchema block runs first, and on a failed session it takes its else branch and throws before the session-failure block is reached:
isSuccessis correctlyfalse(subtype === "success" && !is_error)hasJsonSchemais true; the success branch requiresisSuccess, so it falls toelse- it throws
--json-schema was provided but Claude did not return structured_output. Result subtype: success - the
!isSuccessblock never runs, so neither theis_error:truediagnostic norresultMessage.errorsis ever emitted
So for anyone using --json-schema — the original report, and @sok-kheang-jewelry — the only surfaced error blames the schema and reports Result subtype: success for a run that errored. The real error string is discarded. The existing coverage for this failure shape doesn't exercise the --json-schema path, so the interaction between the two checks went unnoticed.
I don't think this causes signal 1, and fixing it won't fix signal 1. But it does mean the reports in this thread are all being made without access to the underlying error, which likely explains why the collective response has been version bumps — it's the only lever that's visible.
PRs
- #1753 (open) publishes
session_idwhere it is discovered, so it survives these throw paths the wayexecution_filealready does. - I'll open a second one shortly that reorders the session-failure check ahead of the
--json-schemacheck, so the real error surfaces first, with a regression test that setshasJsonSchema: true. It's a block move, no behavior change for passing runs.
Neither of these closes this issue. Signal 1's root cause still looks server-side or account-state-related and isn't something I can address from here.
Data point from another private repo (a pull_request_target review workflow, claude_code_oauth_token auth), plus one observation about account state that may be useful to others in this thread.
Signature — identical to signal 1. {"type":"result","subtype":"success","is_error":true,"duration_ms":~350–580,"num_turns":1,"total_cost_usd":0,"permission_denials_count":0} immediately after init; no assistant turn, no tool call. With --json-schema set, the action then fails with --json-schema was provided but Claude did not return structured_output. Result subtype: success.
Scale. Over 20-08 → 17-09-2026 this shape was 32 of our 52 failed review runs, in six sharp on/off episodes (04-09 ×4, 08-09 ×13 over ~100 min, 09-09 ×7, 10-09 ×2, 15-09 ×1, 17-09 ×7). Within an episode every invocation fails identically; runs that are routed away from the model step in the same window succeed, which made it look intermittent until we checked which "successes" had actually invoked the action. Separately, we saw 4 runs where a session ran 3–14 turns and billed $1.7–3.8 before ending is_error:true.
Held constant across a cliff (17-09, 12:16Z–12:48Z and again 18:34Z–22:44Z): action base-action@5ef2e550 (v1.0.190), Claude Code 2.1.227 (installed by the action, same on both sides), model claude-opus-5, runner image ubuntu24/20260907.300, runner 2.337.0, same OAuth token (last rotated 29-08), prompt sizes from 3-file docs PRs to 50-file code PRs. Anthropic status page: no incident in those windows.
Account-state observation. During the 17-09 evening episode, a subagent running under the same account's interactive credentials was terminated by the API with HTTP 429 — You've hit your session limit · resets 12:20am (Africa/Lusaka) about six minutes after a CI run failed with the zero-cost signature. That is consistent with the "account-state" hypothesis above: in -p mode with an OAuth token, a subscription usage limit appears to surface as is_error:true / subtype:success / cost 0 with no visible text, rather than as a rate_limit_event or error: "rate_limit" on the result. One caveat against reading it as a clean fit: two further zero-cost failures occurred at 22:40Z and 22:44Z, i.e. ~20 minutes after the window the 429 message said it would reset — so either usage refilled the window very quickly, or the limit is not the whole story.
On the reporting gap. Agree with the analysis above that the hasJsonSchema branch throws before the session-failure diagnostic, so nobody in this thread has seen the underlying error. Two things we found useful while waiting on #1784:
- The execution file (
execution_fileoutput, populated even on the throw path) still carries the result message withapi_error_statusand theresultstring (error text whenis_erroris true) — present in the SDK types at 0.3.227. A post-step that reads those two fields from the execution file surfaces the cause without enablingshow_full_output. We implemented that as a bounded, redacted diagnostic in our own classifier; happy to share the approach if useful. total_cost_usd: 0is diagnostic for this shape when the same workflow bills normally on success (ours: $2–6 per completed review), so it can be used to separate "rejected at turn 1" from "errored mid-run" without any text.
Upstream requests from our side: #1784 (surface the session error before the schema check) would have saved us weeks of guessing; and we hit #1795 (num_turns vs --max-turns) once as well, on a run that had completed and posted its review.
Following up my comment above — we have the error text now, and it is not ambiguous.
We shipped the execution-file diagnostic I described (read api_error_status and the result result string from the execution_file output, which is populated even on the throw path). On its first three live failures it printed:
shape=first-turn-zero-cost api_error_status=429 api_retry_statuses=none
untrusted result excerpt (redacted): You've hit your session limit · resets 1:10am (UTC)
Three runs, 17-09 23:29Z / 17-09 23:35Z / 18-09 00:30Z, on claude-code-action v1.0.227 (Claude Code 2.1.274) with claude_code_oauth_token. Same zero-cost, num_turns: 1, is_error: true, subtype: "success" signature as signal 1 in the original report.
So for OAuth-token users, signal 1 is a subscription usage limit. It is not a server-side fault, not an action regression, and no version bump will change it — which is consistent with every pin in this thread being falsified in turn (2.1.245, 2.1.251, and for us 2.1.227 and 2.1.274 all reproduce it).
What makes it so hard to recognise:
- A session limit in
-pmode arrives with noerror: "rate_limit"and norate_limit_event— onlyapi_error_status: 429on the result message. Anything keying on the first two classifies it as a generic execution error. - The
--json-schemabranch throws before the session-failure diagnostic (#1784), so the only surfaced message blames the schema. total_cost_usd: 0means it is invisible in billing, and because the request is rejected at turn 1 there is no assistant turn to look at.
Three consequences we would not have predicted, in case they save someone else the time:
- It looks intermittent when it is not. Runs interleaved with the failures appeared to succeed, but every one of them had been routed away from the model step. Of the runs that actually invoked the action in our window, 5 of 5 failed. Check that the failing step executed in the runs you are comparing against before concluding flakiness.
- CI and interactive use share one budget. Our CI reviews were being starved by concurrent interactive Claude Code sessions on the same account. If you run both, that contention is real and is a scheduling problem rather than a bug.
total_cost_usd: 0is a usable discriminator when your workflow bills normally on success — it separates "rejected at turn 1" from "errored mid-run" with no text at all.
We now classify a trusted api_error_status === 429 on an errored turn as a rate limit rather than an execution error, and say so on the PR: a usage limit is not a defect in the pull request, and the actionable step is to re-run after the reset. Reading the numeric only (never the model-controlled result text, and rejecting a string-typed "429" outside the SDK's number | null contract) keeps it out of anything an untrusted diff could influence.
None of this reduces the case for #1784 — it is what would have told us this on day one instead of after four weeks.
@johump @sok-kheang-jewelry — if your repos also use claude_code_oauth_token, it may be worth checking whether your cliffs line up with subscription usage windows on the account the token was minted from. @farmer-data's account-state reading looks right to us.