{"record":{"id":"5528e77fde8641e7","repo":"github/github-mcp-server","slug":"failed-to-marshal-advisories-w","errorCode":null,"errorMessage":"failed to marshal advisories: %w","messagePattern":"failed to marshal advisories: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/github/security_advisories.go","lineNumber":204,"sourceCode":"\t\t\t}\n\n\t\t\tadvisories, resp, err := client.SecurityAdvisories.ListGlobalSecurityAdvisories(ctx, opts)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to list global 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 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// Global advisories come from the world-readable GitHub Advisory\n\t\t\t// Database (public) but contain externally authored prose\n\t\t\t// (untrusted).\n\t\t\tresult = attachStaticIFCLabel(ctx, deps, result, ifc.LabelGlobalSecurityAdvisory())\n\t\t\treturn result, nil, nil\n\t\t},\n\t)\n}\n\nfunc ListRepositorySecurityAdvisories(t translations.TranslationHelperFunc) inventory.ServerTool {\n\treturn NewTool(\n\t\tToolsetMetadataSecurityAdvisories,\n\t\tmcp.Tool{\n\t\t\tName:        \"list_repository_security_advisories\",\n\t\t\tDescription: t(\"TOOL_LIST_REPOSITORY_SECURITY_ADVISORIES_DESCRIPTION\", \"List repository security advisories for a GitHub repository.\"),","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/security_advisories.go#L186-L222","documentation":"Returned if json.Marshal fails on the global advisories payload. The slice contains only JSON-safe go-github structs, so encoding cannot fail under normal operation; this is defensive dead code. An occurrence would indicate a version mismatch in the go-github types rather than a runtime condition.","triggerScenarios":"No realistic API call produces this.","commonSituations":"Not observed in practice.","solutions":["No runtime action needed - report upstream if it ever fires"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to marshal advisories\") {\n    // plain-data structs cannot fail to marshal: report upstream\n    log.Error(\"impossible marshal failure on advisory list\", \"err\", err)\n}","preventionTips":["No prevention needed - treat as an upstream bug","Pin go-github versions so struct definitions stay stable"],"tags":["go","json","security-advisory","dead-code"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}