{"record":{"id":"bc3c95151fe786ee","repo":"router-for-me/CLIProxyAPI","slug":"xai-discovery-failed-with-status-d-s","errorCode":null,"errorMessage":"xai discovery failed with status %d: %s","messagePattern":"xai discovery failed with status (.+?): (.+?)","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/auth/xai/xai.go","lineNumber":90,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"xai discovery: create request: %w\", err)\n\t}\n\treq.Header.Set(\"Accept\", \"application/json\")\n\tresp, err := a.httpClient.Do(req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"xai discovery: request failed: %w\", err)\n\t}\n\tdefer func() {\n\t\tif errClose := resp.Body.Close(); errClose != nil {\n\t\t\tlog.Errorf(\"xai discovery: close response body error: %v\", errClose)\n\t\t}\n\t}()\n\tbody, err := io.ReadAll(resp.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"xai discovery: read response: %w\", err)\n\t}\n\tif resp.StatusCode != http.StatusOK {\n\t\treturn nil, fmt.Errorf(\"xai discovery failed with status %d: %s\", resp.StatusCode, strings.TrimSpace(string(body)))\n\t}\n\tvar payload struct {\n\t\tDeviceAuthorizationEndpoint string `json:\"device_authorization_endpoint\"`\n\t\tTokenEndpoint               string `json:\"token_endpoint\"`\n\t}\n\tif err = json.Unmarshal(body, &payload); err != nil {\n\t\treturn nil, fmt.Errorf(\"xai discovery: parse response: %w\", err)\n\t}\n\tdeviceAuthorizationEndpoint, err := ValidateOAuthEndpoint(payload.DeviceAuthorizationEndpoint, \"device_authorization_endpoint\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ttokenEndpoint, err := ValidateOAuthEndpoint(payload.TokenEndpoint, \"token_endpoint\")\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Discovery{\n\t\tDeviceAuthorizationEndpoint: deviceAuthorizationEndpoint,","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/router-for-me/CLIProxyAPI/blob/78f0c4079e3e6273d65d03b5549cffc898703264/internal/auth/xai/xai.go#L72-L108","documentation":"Error \"xai discovery failed with status %d: %s\" thrown in router-for-me/CLIProxyAPI.","triggerScenarios":"Thrown at internal/auth/xai/xai.go:90 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the status code and body for the discovery failure reason.","Verify the discovery endpoint URL is correct and reachable."],"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"}