Source Intelligence

DisclaimerUnofficial, and not affiliated with Anthropic. Nearly all of this is read straight out of what ships: npm bundles, captured prompts, published docs. Anthropic's own notes go in verbatim, marked as theirs. The rest is my reading, and every entry carries the strings behind it. If one looks wrong, vote it down and say why.

All of v2.1.163 Home All releases olderv2.1.140 v2.1.165newer

OAuth 401 Recovery for Remote Sessions

What

Remote sessions now wait for a rotated OAuth token after receiving a 401 error, instead of immediately propagating the failure.

Details
  • Wait time is controlled by CLAUDE_CODE_OAUTH_401_WAIT_MS (default: 60,000 ms = 60 seconds for remote sessions, 0 for local sessions).
  • If a valid, non-failed token appears within the timeout window, the request is retried automatically.
  • For remote child sessions (workers), CLAUDE_CODE_AUTH_FAIL_EXIT_MS (default: 600,000 ms = 10 minutes) controls how long to tolerate unrecovered 401s before exiting with a message to the runner to recycle the session with fresh credentials.
  • The "failed access token" (the specific token that got the 401) is tracked so a rotation to an identical token value is not treated as a recovery.
Evidence

Recovery function (search for "OAuth 401 recovery: waiting up to" and "OAuth 401 unrecovered past CLAUDE_CODE_AUTH_FAIL_EXIT_MS")

Strings lifted out of the shipped bundle, so the claim above can be checked against them.

See this entry in the whole of v2.1.163 →