Skip to content

Fix #64: CLI backend: auth errors surface as misleading pydantic parse failure#65

Merged
max-tet merged 1 commit intomainfrom
clayde/issue-64-cli-auth-errors
Apr 7, 2026
Merged

Fix #64: CLI backend: auth errors surface as misleading pydantic parse failure#65
max-tet merged 1 commit intomainfrom
clayde/issue-64-cli-auth-errors

Conversation

@ClaydeCode
Copy link
Copy Markdown
Owner

Closes #64

Added _AUTH_ERROR_PATTERNS list and _is_auth_error() helper in claude.py. In CliBackend.invoke(), auth errors ("failed to authenticate", "not logged in", "authentication_error", "invalid authentication credentials") are now detected after the usage-limit check and raise a clear RuntimeError("Claude CLI authentication failed") before the output reaches parse_response(). In CliBackend.is_available(), expanded the auth check from only "not logged in" to use _is_auth_error(), which also catches "Failed to authenticate" patterns from newer CLI versions. Added 3 new tests covering these cases.

…rror text

Added _AUTH_ERROR_PATTERNS and _is_auth_error() helper alongside the existing
limit-error detection. In CliBackend.invoke(), auth errors are now detected
after the usage-limit check and raise a clear RuntimeError("Claude CLI
authentication failed") before the output reaches parse_response(). In
CliBackend.is_available(), expanded the auth check to cover "failed to
authenticate" in addition to "not logged in".

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@ClaydeCode ClaydeCode requested a review from max-tet April 7, 2026 19:59
@max-tet max-tet merged commit 8afebd7 into main Apr 7, 2026
2 checks passed
@max-tet max-tet deleted the clayde/issue-64-cli-auth-errors branch April 7, 2026 20:02
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.

CLI backend: auth errors surface as misleading pydantic parse failure

2 participants