{"record":{"id":"514abc494a200973","repo":"router-for-me/CLIProxyAPI","slug":"fetch-claude-oauth-s-failed-with-status-d","errorCode":null,"errorMessage":"fetch Claude OAuth %s failed with status %d","messagePattern":"fetch Claude OAuth (.+?) failed with status (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/auth/claude/anthropic_auth.go","lineNumber":255,"sourceCode":"\tapplyClaudeOAuthAxiosHeaders(req)\n\treq.Header.Set(\"Authorization\", \"Bearer \"+accessToken)\n\treq.Header.Set(\"Cache-Control\", \"no-cache\")\n\n\tresp, errDo := o.httpClient.Do(req)\n\tif errDo != nil {\n\t\treturn nil, fmt.Errorf(\"fetch Claude OAuth %s: %w\", label, errDo)\n\t}\n\tdefer func() {\n\t\tif errClose := resp.Body.Close(); errClose != nil {\n\t\t\tlog.Errorf(\"failed to close Claude OAuth %s response body: %v\", label, errClose)\n\t\t}\n\t}()\n\tbody, errRead := readClaudeOAuthResponseBody(resp)\n\tif errRead != nil {\n\t\treturn nil, fmt.Errorf(\"read Claude OAuth %s response: %w\", label, errRead)\n\t}\n\tif resp.StatusCode < http.StatusOK || resp.StatusCode >= http.StatusMultipleChoices {\n\t\treturn nil, fmt.Errorf(\"fetch Claude OAuth %s failed with status %d\", label, resp.StatusCode)\n\t}\n\treturn body, nil\n}\n\n// FetchOAuthProfile retrieves the account identity associated with an OAuth access token.\nfunc (o *ClaudeAuth) FetchOAuthProfile(ctx context.Context, accessToken string) (*OAuthProfile, error) {\n\tbody, errFetch := o.fetchOAuthControlPlaneJSON(ctx, ProfileURL, accessToken, \"profile\")\n\tif errFetch != nil {\n\t\treturn nil, errFetch\n\t}\n\tvar profile OAuthProfile\n\tif errUnmarshal := json.Unmarshal(body, &profile); errUnmarshal != nil {\n\t\treturn nil, fmt.Errorf(\"parse Claude OAuth profile response: %w\", errUnmarshal)\n\t}\n\tif strings.TrimSpace(profile.Account.UUID) == \"\" {\n\t\treturn nil, fmt.Errorf(\"fetch Claude OAuth profile: response account UUID is empty\")\n\t}\n\treturn &profile, nil","sourceCodeStart":237,"sourceCodeEnd":273,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/auth/claude/anthropic_auth.go#L237-L273","documentation":"Error \"fetch Claude OAuth %s failed with status %d\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/auth/claude/anthropic_auth.go:255 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the HTTP status code: re-run the OAuth login flow if it is 401/403.","Verify network access to the Claude OAuth endpoint and retry the request."],"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-15T17:31:12.345Z"}