What this thread does
For Claude Code Vertex gateway 401s with an expired helper token, consider the reporter's shorter helper-cache workaround while treating automatic rejection-triggered refresh as unresolved (edonaliko, anthropics/claude-code #105408).
Do first: compare CLAUDE_CODE_API_KEY_HELPER_TTL_MS with the helper's refresh margin; edonaliko reports using 90000 when their helper renews tokens with under two minutes remaining (October 27).
The report's exact symptom is “401 Unauthorized: Token has expired”: requests continue using cached output after rejection. There is one live reporter plus a separate diagnostic analysis (edonaliko, Ben-Home).
Not for: helper execution failures or noisy stdout; see claude-code-apikeyhelper-script-is-failing-stdout.
Diagnostic: 401 Unauthorized: Token has expired
Affected configuration: edonaliko reports Claude Code 2.1.308 on macOS, Terminal.app, with CLAUDE_CODE_USE_VERTEX=1, CLAUDE_CODE_SKIP_VERTEX_AUTH=1, an internal Vertex-compatible gateway and apiKeyHelper. Their gateway authenticates users with 60-minute Okta ID tokens, while holding the GCP credentials itself. They report recovery with the same helper and gateway in Bedrock mode, but no helper rerun after the Vertex gateway's 401 (October 27, #105408).
Cause and the two proposed responses
- Reporter's diagnosis: edonaliko's inspection of the 2.1.304 bundle suggests Vertex classifies the 401 as a GCP credential error before reaching the generic helper-cache clearing path. They propose letting gateway-auth 401s reach that path or clearing the helper cache in the Vertex branch. As of November 19, 2026, the report proposes avoiding GCP-credential classification of a 401 when
CLAUDE_CODE_SKIP_VERTEX_AUTHis set (report and code walkthrough). - Reported workaround: edonaliko reports setting the helper TTL to 90,000 ms, below their helper's two-minute refresh margin, so the helper re-runs every 90 seconds instead of only when needed. This is specific to that helper and costs more helper invocations; it does not repair rejection-triggered refresh (same report).
- Separate analysis: Ben-Home suggests a five-minute TTL against a 60-minute token to distinguish scheduled renewal from the missing 401 path. Their October 29 reply is a diagnostic proposal, not an independent live reproduction or proof that five minutes fits edonaliko's helper (comment).
A reader check can compare helper invocation timestamps around token renewal and a naturally occurring rejection; that adapts the invocation-log comparison in edonaliko's reproduction. Do not count a shorter cache as proof that the 401 handler reruns the helper (reproduction).
Resolution status
#105408 is open. The anthropics/claude-code 2.1.316 release includes gateway sign-in and other auth changes but does not name this Vertex helper-refresh defect. No released fix is established by these sources.
Limits
Single live reporter; the second contributor supplies analysis rather than another deployment result. Native Vertex GCP authentication, other helper implementations and Bedrock failures are outside this case. The TTL must fit actual token age and helper refresh behavior; no universal value is established.
Checked 2026-11-19.
Started from a post by @edonaliko, packaged by the editor. Original post