{"record":{"id":"d30c7dbc59f25a48","repo":"github/github-mcp-server","slug":"failed-to-marshal-alert-w","errorCode":null,"errorMessage":"failed to marshal alert: %w","messagePattern":"failed to marshal alert: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/github/secret_scanning.go","lineNumber":90,"sourceCode":"\t\t\t\treturn ghErrors.NewGitHubAPIErrorResponse(ctx,\n\t\t\t\t\tfmt.Sprintf(\"failed to get alert with number '%d'\", alertNumber),\n\t\t\t\t\tresp,\n\t\t\t\t\terr,\n\t\t\t\t), nil, nil\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 get alert\", resp, body), nil, nil\n\t\t\t}\n\n\t\t\tr, err := json.Marshal(alert)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to marshal alert: %w\", err)\n\t\t\t}\n\n\t\t\tresult := utils.NewToolResultText(string(r))\n\t\t\t// Secret scanning alerts are access-restricted regardless of repo\n\t\t\t// visibility and surface the matched secret material itself, so the\n\t\t\t// label is always private-untrusted.\n\t\t\tresult = attachStaticIFCLabel(ctx, deps, result, ifc.LabelSecurityAlert())\n\t\t\treturn result, nil, nil\n\t\t},\n\t)\n}\n\nfunc ListSecretScanningAlerts(t translations.TranslationHelperFunc) inventory.ServerTool {\n\tschema := &jsonschema.Schema{\n\t\tType: \"object\",\n\t\tProperties: map[string]*jsonschema.Schema{\n\t\t\t\"owner\": {\n\t\t\t\tType:        \"string\",","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/secret_scanning.go#L72-L108","documentation":"Returned if json.Marshal fails on the *github.SecretScanningAlert returned by the API. The go-github struct contains only JSON-safe field types (strings, ints, pointers, time.Time), so encoding/json cannot fail on it in practice; this branch is defensive dead code. A real occurrence would indicate a corrupted object or an incompatible go-github version, not a runtime condition.","triggerScenarios":"No realistic API call produces this; marshaling a plain data struct with no channels, funcs, or cycles cannot return UnsupportedTypeError or UnsupportedValueError.","commonSituations":"Not observed in practice; developers only meet it while reading the handler code.","solutions":["No runtime action needed - treat any occurrence as a bug and report it upstream with the go-github version in go.mod"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to marshal alert\") {\n    // json.Marshal of a plain go-github struct cannot fail: report as bug\n    log.Error(\"impossible marshal failure on SecretScanningAlert\", \"err\", err)\n}","preventionTips":["No prevention needed - treat any occurrence as an upstream bug","Pin go-github versions in go.mod so struct types cannot drift unexpectedly"],"tags":["go","json","secret-scanning","dead-code"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}