{"record":{"id":"97f187c1fa1003fc","repo":"googleapis/mcp-toolbox","slug":"failed-to-unmarshal-job-json-w","errorCode":null,"errorMessage":"failed to unmarshal job JSON: %w","messagePattern":"failed to unmarshal job JSON: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/dataproc/dataproc.go","lineNumber":410,"sourceCode":"\treq := &dataprocpb.GetJobRequest{\n\t\tProjectId: s.Project,\n\t\tRegion:    s.Region,\n\t\tJobId:     jobId,\n\t}\n\n\tjobPb, err := client.GetJob(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get job: %w\", err)\n\t}\n\n\tjsonBytes, err := protojson.Marshal(jobPb)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal job to JSON: %w\", err)\n\t}\n\n\tvar result map[string]any\n\tif err := json.Unmarshal(jsonBytes, &result); err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to unmarshal job JSON: %w\", err)\n\t}\n\n\tconsoleUrl := JobConsoleURLFromProto(jobPb, s.Region)\n\tlogsUrl, err := JobLogsURLFromProto(jobPb, s.Region)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating logs url: %v\", err)\n\t}\n\n\twrappedResult := map[string]any{\n\t\t\"consoleUrl\": consoleUrl,\n\t\t\"logsUrl\":    logsUrl,\n\t\t\"job\":        result,\n\t}\n\n\treturn wrappedResult, nil\n}\n","sourceCodeStart":392,"sourceCodeEnd":427,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/dataproc/dataproc.go#L392-L427","documentation":"GetJob unmarshals the protojson-produced bytes into map[string]any. This error means json.Unmarshal failed on bytes that protojson just produced — practically indicates the JSON bytes are invalid, which points to a corrupted marshal step or memory/exotic edge case rather than user input.","triggerScenarios":"json.Unmarshal(jsonBytes, &result) failing after protojson.Marshal succeeded — an internal inconsistency, essentially unreachable in normal operation.","commonSituations":"Effectively only seen with custom builds, instrumented JSON libraries, or vendoring anomalies.","solutions":["Log jsonBytes on failure to inspect what protojson produced","Verify the standard encoding/json package is in use (no shadowed imports/build tags)","Rebuild the project cleanly (go clean && go build) to rule out stale artifacts"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"job, err := svc.GetJob(ctx, jobId)\nif err != nil && strings.Contains(err.Error(), \"unmarshal job JSON\") {\n\t// rebuild cleanly and retry; log jsonBytes if reproducible\n}","preventionTips":["Avoid shadowing the encoding/json import","Rebuild with go clean after unusual toolchain or vendoring changes","Report persistent occurrences upstream"],"tags":["gcp","dataproc","serialization","json"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}