{"record":{"id":"16ea9a83ccc9d2fb","repo":"github/github-mcp-server","slug":"authorization-did-not-complete","errorCode":null,"errorMessage":"authorization did not complete","messagePattern":"authorization did not complete","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/oauth/manager.go","lineNumber":417,"sourceCode":"func (m *Manager) outcomeAfterFlow(flowID string) (*Outcome, error) {\n\tm.mu.Lock()\n\tif flowID == \"\" || flowID != m.flowID {\n\t\tm.mu.Unlock()\n\t\treturn nil, ErrStaleAuthorizationFlow\n\t}\n\tpending := m.pending\n\terr := m.lastErr\n\tm.mu.Unlock()\n\tif m.AccessToken() != \"\" {\n\t\treturn nil, nil\n\t}\n\tif pending != nil {\n\t\treturn &Outcome{UserAction: pending, FlowID: flowID}, nil\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn nil, errors.New(\"authorization did not complete\")\n}\n\nfunc (m *Manager) oauth2Config(redirectURL string) *oauth2.Config {\n\treturn &oauth2.Config{\n\t\tClientID:     m.config.ClientID,\n\t\tClientSecret: m.config.ClientSecret,\n\t\tRedirectURL:  redirectURL,\n\t\tScopes:       m.config.Scopes,\n\t\tEndpoint:     m.config.Endpoint,\n\t}\n}\n","sourceCodeStart":399,"sourceCodeEnd":429,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/internal/oauth/manager.go#L399-L429","documentation":"Second guard of validateBlamePath for get_file_blame: a leading '/' is rejected because the GraphQL blame(path:) argument must be relative to the repository root. An absolute-looking path never matches a file in the repository (GitHub's git trees have no leading slash), so the server fails fast with 'path must be relative to the repository root (no leading \"/\")' instead of returning empty blame ranges.","triggerScenarios":"Passing \"/src/main.go\" instead of \"src/main.go\"; converting a local filesystem path to the tool argument unchanged; path built with filepath.Join(\"/\", rel).","commonSituations":"Developers pasting paths from editors or shells, which usually show absolute paths; porting code that used the REST contents API where a leading slash is tolerated; LLM callers normalizing paths incorrectly.","solutions":["Strip the leading slash: strings.TrimPrefix(path, \"/\")","Derive the argument as the path relative to the repo root, not the absolute local path","Validate client-side with the same rule before calling the tool"],"exampleFix":"// before\n{\"owner\":\"octocat\",\"repo\":\"Hello-World\",\"path\":\"/src/main.go\"}\n\n// after\n{\"owner\":\"octocat\",\"repo\":\"Hello-World\",\"path\":\"src/main.go\"}","handlingStrategy":"validation","validationCode":"func toRepoRelativePath(p string) string {\n\treturn strings.TrimPrefix(strings.TrimSpace(p), \"/\")\n}","typeGuard":"func isBlamePathError(err error) bool {\n\treturn err != nil && strings.HasPrefix(err.Error(), \"path must\")\n}","tryCatchPattern":"path = strings.TrimPrefix(strings.TrimSpace(path), \"/\")\nif strings.HasPrefix(path, \"/\") || path == \"\" {\n\treturn nil, fmt.Errorf(\"path must be repository-root relative\")\n}\nres, _, err := callGetFileBlame(ctx, buildArgs(owner, repo, path))\nif isBlamePathError(err) {\n\treturn nil, fmt.Errorf(\"fix the path argument: %w\", err)\n}","preventionTips":["Convert editor/shell absolute paths with filepath.Rel(repoRoot, abs) before sending","Never paste absolute paths directly into the path argument","Remember the REST contents API tolerates a leading slash but get_file_blame does not","Add a client-side lint for leading '/' on tool arguments"],"tags":["go","validation","user-input","blame"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}