Bug
When the CLI backend encounters an authentication error, the failure manifests as a confusing pydantic validation error instead of a clear auth failure message.
Root Cause
CliBackend.invoke() in claude.py does not treat is_error=True with exit code 0 as a fatal error. The Claude CLI exits with code 0 but sets is_error: true in the JSON output, with result containing the error text:
"Failed to authenticate. API Error: 401 {\"type\":\"error\",\"error\":{\"type\":\"authentication_error\",\"message\":\"Invalid authentication credentials\"},...}"
This result string is returned as output_text. The caller passes it to parse_response(), which extracts the embedded API error JSON object via _extract_json(), then fails pydantic validation — producing a log like:
Failed to parse preliminary plan response: LLM response failed validation for PreliminaryPlanResponse: 3 validation errors
...
Data: {'type': 'error', 'error': {'type': 'authentication_error', 'message': 'Invalid authentication credentials'}, ...}
Expected Behavior
An auth error should surface as a clear log message like "Claude CLI authentication failed" and the issue should be marked failed (or the tick skipped), not produce a pydantic parse failure.
Fix
In CliBackend.invoke(), after parsing the JSON output, check for is_error=True and inspect the result text for known fatal error patterns (authentication errors, "not logged in", etc.). Raise an appropriate exception or log clearly and propagate the failure before reaching parse_response().
Additionally, is_claude_available() should return False on auth errors (currently it only catches "not logged in" text, missing the "Failed to authenticate" pattern).
Bug
When the CLI backend encounters an authentication error, the failure manifests as a confusing pydantic validation error instead of a clear auth failure message.
Root Cause
CliBackend.invoke()inclaude.pydoes not treatis_error=Truewith exit code 0 as a fatal error. The Claude CLI exits with code 0 but setsis_error: truein the JSON output, withresultcontaining the error text:This
resultstring is returned asoutput_text. The caller passes it toparse_response(), which extracts the embedded API error JSON object via_extract_json(), then fails pydantic validation — producing a log like:Expected Behavior
An auth error should surface as a clear log message like
"Claude CLI authentication failed"and the issue should be marked failed (or the tick skipped), not produce a pydantic parse failure.Fix
In
CliBackend.invoke(), after parsing the JSON output, check foris_error=Trueand inspect the result text for known fatal error patterns (authentication errors, "not logged in", etc.). Raise an appropriate exception or log clearly and propagate the failure before reachingparse_response().Additionally,
is_claude_available()should returnFalseon auth errors (currently it only catches"not logged in"text, missing the"Failed to authenticate"pattern).