{"record":{"id":"edce15092d97ddc3","repo":"googleapis/mcp-toolbox","slug":"failed-to-marshal-batch-to-json-w","errorCode":null,"errorMessage":"failed to marshal batch to JSON: %w","messagePattern":"failed to marshal batch to JSON: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/serverlessspark/serverlessspark.go","lineNumber":295,"sourceCode":"\t\tbatches = append(batches, batch)\n\t}\n\treturn batches, nil\n}\n\nfunc (s *Source) GetBatch(ctx context.Context, name string) (map[string]any, error) {\n\tclient := s.GetBatchControllerClient()\n\treq := &dataprocpb.GetBatchRequest{\n\t\tName: fmt.Sprintf(\"projects/%s/locations/%s/batches/%s\", s.GetProject(), s.GetLocation(), name),\n\t}\n\n\tbatchPb, err := client.GetBatch(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get batch: %w\", err)\n\t}\n\n\tjsonBytes, err := protojson.Marshal(batchPb)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal batch 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 batch JSON: %w\", err)\n\t}\n\n\tconsoleUrl, err := BatchConsoleURLFromProto(batchPb)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error generating console url: %v\", err)\n\t}\n\tlogsUrl, err := BatchLogsURLFromProto(batchPb)\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,","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/serverlessspark/serverlessspark.go#L277-L313","documentation":"protojson.Marshal failed to serialize the fetched Batch protobuf into JSON — an internal serialization failure that normally indicates an unexpected proto state rather than bad user input.","triggerScenarios":"Thrown at internal/sources/serverlessspark/serverlessspark.go:295 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the GetBatch call for a fresh proto message","Check for unsupported proto fields (unknown types, non-UTF8 strings)","Report upstream if consistently reproducible"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}