{"record":{"id":"9d5b9d10c5cc0b41","repo":"github/github-mcp-server","slug":"failed-to-list-organization-repository-security-ad","errorCode":null,"errorMessage":"failed to list organization repository security advisories: %w","messagePattern":"failed to list organization repository security advisories: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/github/security_advisories.go","lineNumber":465,"sourceCode":"\t\t\tclient, err := deps.GetClient(ctx)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to get GitHub client: %w\", err)\n\t\t\t}\n\n\t\t\topts := &github.ListRepositorySecurityAdvisoriesOptions{}\n\t\t\tif direction != \"\" {\n\t\t\t\topts.Direction = direction\n\t\t\t}\n\t\t\tif sortField != \"\" {\n\t\t\t\topts.Sort = sortField\n\t\t\t}\n\t\t\tif state != \"\" {\n\t\t\t\topts.State = state\n\t\t\t}\n\n\t\t\tadvisories, resp, err := client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg(ctx, org, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to list organization repository security advisories: %w\", err)\n\t\t\t}\n\t\t\tdefer func() { _ = resp.Body.Close() }()\n\n\t\t\tif resp.StatusCode != http.StatusOK {\n\t\t\t\tbody, err := io.ReadAll(resp.Body)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to read response body: %w\", err)\n\t\t\t\t}\n\t\t\t\treturn ghErrors.NewGitHubAPIStatusErrorResponse(ctx, \"failed to list organization repository advisories\", resp, body), nil, nil\n\t\t\t}\n\n\t\t\tr, err := json.Marshal(advisories)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to marshal advisories: %w\", err)\n\t\t\t}\n\n\t\t\tresult := utils.NewToolResultText(string(r))\n\t\t\t// Org-wide advisory listings span the organization's repositories","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/security_advisories.go#L447-L483","documentation":"client.SecurityAdvisories.ListRepositorySecurityAdvisoriesForOrg returned an error: the REST call to list an organization's repository security advisories failed at transport level or came back non-2xx (wrapped as *github.ErrorResponse).","triggerScenarios":"Org login misspelled or nonexistent (404); authenticated user is not an org member with visibility into repository security advisories (403/404); invalid query values (direction not asc/desc, sort not created/updated, state not draft/published); secondary rate limits.","commonSituations":"Using a PAT from outside the organization; org-level restrictions on security advisory visibility; passing a state value the API version rejects.","solutions":["Verify the org login spelling","Confirm the token's user belongs to the org and can view repository security advisories","Use only supported values: direction=asc|desc, sort=created|updated, state=draft|published","Unwrap *github.ErrorResponse for the exact status and API message"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"var validDirection = map[string]bool{\"asc\": true, \"desc\": true}\nvar validSort = map[string]bool{\"created\": true, \"updated\": true}\nvar validState = map[string]bool{\"draft\": true, \"published\": true}\nif direction != \"\" && !validDirection[direction] { return fmt.Errorf(\"invalid direction\") }\nif sortField != \"\" && !validSort[sortField] { return fmt.Errorf(\"invalid sort\") }\nif state != \"\" && !validState[state] { return fmt.Errorf(\"invalid state\") }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Validate org login format (no slashes/spaces) before calling","Confirm membership and security-advisory visibility for the token's user","Whitelist enum param values client-side to match the GitHub API docs"],"tags":["github-api","security-advisory","authorization","mcp-tool"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}