{"record":{"id":"c6ed094a32dfc54e","repo":"router-for-me/CLIProxyAPI","slug":"refresh-token-is-required","errorCode":null,"errorMessage":"refresh token is required","messagePattern":"refresh token is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/auth/claude/anthropic_auth.go","lineNumber":488,"sourceCode":"\t}\n\n\treturn bundle, nil\n}\n\n// RefreshTokens refreshes the access token using the refresh token.\n// This method exchanges a valid refresh token for a new access token,\n// extending the user's authenticated session.\n//\n// Parameters:\n//   - ctx: The context for the request\n//   - refreshToken: The refresh token to use for getting new access token\n//\n// Returns:\n//   - *ClaudeTokenData: The new token data with updated access token\n//   - error: An error if token refresh fails\nfunc (o *ClaudeAuth) RefreshTokens(ctx context.Context, refreshToken string) (*ClaudeTokenData, error) {\n\tif refreshToken == \"\" {\n\t\treturn nil, fmt.Errorf(\"refresh token is required\")\n\t}\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\tif blockedUntil := claudeRefreshBlockedUntil(refreshToken); blockedUntil.After(time.Now()) {\n\t\treturn nil, &refreshHTTPError{\n\t\t\tstatus:    http.StatusTooManyRequests,\n\t\t\tmessage:   fmt.Sprintf(\"refresh temporarily blocked until %s\", blockedUntil.Format(time.RFC3339)),\n\t\t\tretryable: false,\n\t\t}\n\t}\n\n\tresult, err, _ := claudeRefreshGroup.Do(refreshToken, func() (interface{}, error) {\n\t\trefreshCtx, cancelRefresh := context.WithTimeout(context.WithoutCancel(ctx), claudeRefreshTimeout)\n\t\tdefer cancelRefresh()\n\t\trefreshCtx = context.WithValue(refreshCtx, claudeRefreshHandshakeTimeoutContextKey{}, claudeRefreshHandshakeTimeout)\n\t\treturn o.refreshTokensSingleFlight(refreshCtx, refreshToken)\n\t})","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/auth/claude/anthropic_auth.go#L470-L506","documentation":"Error \"refresh token is required\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/auth/claude/anthropic_auth.go:488 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a refresh token from a previous successful token exchange.","Re-run the full OAuth login flow to obtain a new refresh token."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"78f0c4079e3e6273d65d03b5549cffc898703264","analyzedAt":"2026-08-15T12:26:37.444Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}