{"record":{"id":"2672a535db618ef8","repo":"googleapis/mcp-toolbox","slug":"failed-to-unmarshal-session-template-json-w","errorCode":null,"errorMessage":"failed to unmarshal session template JSON: %w","messagePattern":"failed to unmarshal session template JSON: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/serverlessspark/serverlessspark.go","lineNumber":347,"sourceCode":"func (s *Source) GetSessionTemplate(ctx context.Context, name string) (map[string]any, error) {\n\tclient := s.GetSessionTemplateControllerClient()\n\treq := &dataprocpb.GetSessionTemplateRequest{\n\t\tName: fmt.Sprintf(\"projects/%s/locations/%s/sessionTemplates/%s\", s.GetProject(), s.GetLocation(), name),\n\t}\n\n\tsessionTemplatePb, err := client.GetSessionTemplate(ctx, req)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get session template: %w\", err)\n\t}\n\n\tjsonBytes, err := protojson.Marshal(sessionTemplatePb)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to marshal session template 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 session template JSON: %w\", err)\n\t}\n\n\twrappedResult := map[string]any{\n\t\t\"sessionTemplate\": result,\n\t}\n\n\treturn wrappedResult, nil\n}\n\n// ToSessionTemplates converts a slice of protobuf SessionTemplate messages to a slice of SessionTemplate structs.\nfunc ToSessionTemplates(sessionTemplatePbs []*dataprocpb.SessionTemplate) ([]SessionTemplate, error) {\n\tsessionTemplates := make([]SessionTemplate, 0, len(sessionTemplatePbs))\n\tfor _, sessionTemplatePb := range sessionTemplatePbs {\n\n\t\tsessionTemplate := SessionTemplate{\n\t\t\tName:        sessionTemplatePb.Name,\n\t\t\tDescription: sessionTemplatePb.Description,\n\t\t\tCreator:     sessionTemplatePb.Creator,","sourceCodeStart":329,"sourceCodeEnd":365,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/serverlessspark/serverlessspark.go#L329-L365","documentation":"encoding/json.Unmarshal failed to decode the protojson output into map[string]any in GetSessionTemplate — the serialized template contained a JSON construct the decoder rejects.","triggerScenarios":"Thrown at internal/sources/serverlessspark/serverlessspark.go:347 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the fetch","Inspect logs for the offending JSON","Report consistently failing templates upstream"],"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"}