{"record":{"id":"c5e9beee99b9fe1a","repo":"github/github-mcp-server","slug":"failed-to-marshal-labels-w","errorCode":null,"errorMessage":"failed to marshal labels: %w","messagePattern":"failed to marshal labels: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/github/labels.go","lineNumber":217,"sourceCode":"\n\t\t\tlabels := make([]map[string]any, len(query.Repository.Labels.Nodes))\n\t\t\tfor i, labelNode := range query.Repository.Labels.Nodes {\n\t\t\t\tlabels[i] = map[string]any{\n\t\t\t\t\t\"id\":          fmt.Sprintf(\"%v\", labelNode.ID),\n\t\t\t\t\t\"name\":        string(labelNode.Name),\n\t\t\t\t\t\"color\":       string(labelNode.Color),\n\t\t\t\t\t\"description\": string(labelNode.Description),\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tresponse := map[string]any{\n\t\t\t\t\"labels\":     labels,\n\t\t\t\t\"totalCount\": int(query.Repository.Labels.TotalCount),\n\t\t\t}\n\n\t\t\tout, err := json.Marshal(response)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to marshal labels: %w\", err)\n\t\t\t}\n\n\t\t\tresult := utils.NewToolResultText(string(out))\n\t\t\t// Labels are structural repo metadata defined by collaborators\n\t\t\t// (trusted); confidentiality follows repo visibility.\n\t\t\tresult = attachRepoVisibilityIFCLabelLazy(ctx, deps, owner, repo, result, ifc.LabelRepoMetadata)\n\t\t\treturn result, nil, nil\n\t\t},\n\t)\n}\n\n// LabelWrite handles create, update, and delete operations for GitHub labels\nfunc LabelWrite(t translations.TranslationHelperFunc) inventory.ServerTool {\n\treturn NewTool(\n\t\tToolsetLabels,\n\t\tmcp.Tool{\n\t\t\tName:        \"label_write\",\n\t\t\tDescription: t(\"TOOL_LABEL_WRITE_DESCRIPTION\", \"Perform write operations on repository labels. To set labels on issues, use the 'update_issue' tool.\"),","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/labels.go#L199-L235","documentation":"The list_labels tool failed to JSON-encode its response map ({labels: [...], totalCount: n}) whose leaves are all strings and ints. This guard is effectively unreachable; hitting it indicates an internal serialization defect, not a caller mistake.","triggerScenarios":"Not triggerable via arguments; would require internal changes that introduce non-serializable values into the response map.","commonSituations":"Practically unseen; only appears after server-side code changes to the response shape.","solutions":["Report as an internal bug with the server version and repository details","Retry the call once — the label listing query already succeeded"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to marshal labels\") {\n    // Unreachable-in-practice guard; treat as internal bug, not input error.\n}","preventionTips":["Report server version plus repo label set if this ever appears","Keep a fallback path that lists labels via a direct gh CLI call during outages"],"tags":["json","serialization","labels","defensive"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}