{"record":{"id":"68afe3ed119ba9bd","repo":"github/github-mcp-server","slug":"github-authorization-failed-w","errorCode":null,"errorMessage":"github authorization failed: %w","messagePattern":"github authorization failed: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/ghmcp/oauth.go","lineNumber":165,"sourceCode":"\n\t\t\tif mgr.HasToken() {\n\t\t\t\treturn next(ctx, req)\n\t\t\t}\n\t\t\tif serverMayInitiateElicitation(req.Session) {\n\t\t\t\treturn authorizeViaServerElicitation(ctx, mgr, next, req, logger)\n\t\t\t}\n\t\t\treturn startMultiRoundTripAuthorization(ctx, mgr, next, req, logger)\n\t\t}\n\t}\n}\n\n// authorizeViaServerElicitation drives authorization on legacy protocol versions\n// (before 2026-07-28), where the server may present the prompt itself via\n// server-initiated elicitation. It blocks until the token arrives, then proceeds.\nfunc authorizeViaServerElicitation(ctx context.Context, mgr oauthAuthenticator, next mcp.ToolHandler, req *mcp.CallToolRequest, logger *slog.Logger) (*mcp.CallToolResult, error) {\n\toutcome, err := mgr.Authenticate(ctx, &sessionPrompter{session: req.Session})\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"github authorization failed: %w\", err)\n\t}\n\tif outcome != nil && outcome.UserAction != nil {\n\t\tlogger.Info(\"surfacing github authorization instructions to user\")\n\t\treturn &mcp.CallToolResult{\n\t\t\tContent: []mcp.Content{&mcp.TextContent{Text: outcome.UserAction.Message}},\n\t\t}, nil\n\t}\n\treturn next(ctx, req)\n}\n\n// authorizationElicitResponse finds the authorization response and extracts the\n// flow ID encoded in its input-request key.\nfunc authorizationElicitResponse(responses mcp.InputResponseMap) (string, *mcp.ElicitResult, bool) {\n\tfor id, response := range responses {\n\t\tflowID, ok := strings.CutPrefix(id, oauthElicitIDPrefix)\n\t\tif !ok || flowID == \"\" {\n\t\t\tcontinue\n\t\t}","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/internal/ghmcp/oauth.go#L147-L183","documentation":"Error \"github authorization failed: %w\" thrown in github/github-mcp-server.","triggerScenarios":"Thrown at internal/ghmcp/oauth.go:165 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}