Repository navigation
Conversation
DeepSeek answers chat_session/create and create_pow_challenge for an
expired or revoked login with HTTP 200 and {"code":40003,"msg":"INVALID_TOKEN"}.
The account pool only reacted to HTTP 401/403/429, so such an account stayed
in rotation and every request routed to it failed with "Could not create
DeepSeek chat session (HTTP 200)".
Treat an invalid-token body as HTTP 401: the account goes into cooldown
and the request is replayed on another ready account; with no other
account the client gets a 401 authentication_error. The message text is
matched, not the code, because 40003 is also used for "Too many messages".
Refs ForgetMeAI#42
Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When a DeepSeek Web login expires or is revoked,
chat_session/createandcreate_pow_challengestill answer HTTP 200, with the error in the body:{"code":40003,"msg":"INVALID_TOKEN","data":null}The account pool only reacts to HTTP 401/403/429, so such an account is never put into cooldown. It stays in rotation,
/healthkeeps reporting it as ready, and every request routed to it fails withCould not create DeepSeek chat session (HTTP 200) ... INVALID_TOKEN. This is the error reported in #42.This PR:
chat_session/create, file upload/status andcreate_pow_challengeas HTTP 401;DEEPSEEK_ACCOUNT_COOLDOWN_MScooldown and the request is replayed on another ready account through the existing failover path;401 authentication_errorinstead of a generic 500;INVALID_TOKEN/invalid token/Authorization Failed), not the code:40003is also used for "Too many messages", which must keep its short rate-limit cooldown.Refs #42
Verification
npm test: 104/104 passing, including 2 new integration tests:INVALID_TOKENfails over to the next account and is put into cooldown;mainand pass with this change.git diff --checkpasses.{"code":40003,"msg":"INVALID_TOKEN"}(confirmed bynpm run doctor:Authorization Failed (invalid token)) while/healthstill listed it as ready. The live failover itself was only covered by the mock tests, because the expired account had already been re-logged in by then.🤖 Generated with Claude Code