{"record":{"id":"a8212b797599563f","repo":"github/github-mcp-server","slug":"failed-to-marshal-label-w","errorCode":null,"errorMessage":"failed to marshal label: %w","messagePattern":"failed to marshal label: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/github/labels.go","lineNumber":111,"sourceCode":"\n\t\t\tif err := client.Query(ctx, &query, vars); err != nil {\n\t\t\t\treturn ghErrors.NewGitHubGraphQLErrorResponse(ctx, \"Failed to find label\", err), nil, nil\n\t\t\t}\n\n\t\t\tif query.Repository.Label.Name == \"\" {\n\t\t\t\treturn utils.NewToolResultError(fmt.Sprintf(\"label '%s' not found in %s/%s\", name, owner, repo)), nil, nil\n\t\t\t}\n\n\t\t\tlabel := map[string]any{\n\t\t\t\t\"id\":          fmt.Sprintf(\"%v\", query.Repository.Label.ID),\n\t\t\t\t\"name\":        string(query.Repository.Label.Name),\n\t\t\t\t\"color\":       string(query.Repository.Label.Color),\n\t\t\t\t\"description\": string(query.Repository.Label.Description),\n\t\t\t}\n\n\t\t\tout, err := json.Marshal(label)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"failed to marshal label: %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// GetLabelForLabelsToolset returns the same GetLabel tool but registered in the labels toolset.\n// This provides conformance with the original behavior where get_label was in both toolsets.\nfunc GetLabelForLabelsToolset(t translations.TranslationHelperFunc) inventory.ServerTool {\n\ttool := GetLabel(t)\n\ttool.Toolset = ToolsetLabels\n\treturn tool\n}","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/github/github-mcp-server/blob/0ea1f775a7c73eff1bd2e25904d01136756bbfe2/pkg/github/labels.go#L93-L129","documentation":"The get_label tool failed to JSON-encode the label map built from GraphQL results (id, name, color, description — all strings). Marshal errors are effectively impossible for this shape; the guard exists for safety and signals an internal serialization bug if ever hit.","triggerScenarios":"Not reproducible through the API with the current string-only map; would require the map values to become unsupported types via a code change.","commonSituations":"Essentially never seen; if reported, it follows a server modification of the label map structure.","solutions":["Treat as an internal bug: report the github-mcp-server version and label data involved","Retry once to rule out a transient anomaly; the label query itself already succeeded"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"failed to marshal label\") {\n    // Internal serialization bug; the label lookup succeeded. File an issue with the version.\n}","preventionTips":["Pin server versions and watch the changelog for label response changes","Log full error context when this fires to help maintainers reproduce"],"tags":["json","serialization","labels","defensive"],"backgroundTag":null,"analyzedSha":"0ea1f775a7c73eff1bd2e25904d01136756bbfe2","analyzedAt":"2026-08-15T18:10:19.804Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}