{"record":{"id":"0584c83d72300e8f","repo":"googleapis/mcp-toolbox","slug":"failed-to-marshal-generation-options-map-w","errorCode":null,"errorMessage":"failed to marshal generation options map: %w","messagePattern":"failed to marshal generation options map: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cloudgda/cloudgda.go","lineNumber":102,"sourceCode":"\tif err := protojson.Unmarshal(jsonBytes, q.QueryDataContext); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal context to proto: %w\", err)\n\t}\n\treturn nil\n}\n\n// GenerationOptions wraps geminidataanalyticspb.GenerationOptions to support YAML decoding via protojson.\ntype GenerationOptions struct {\n\t*geminidataanalyticspb.GenerationOptions\n}\n\nfunc (g *GenerationOptions) UnmarshalYAML(b []byte) error {\n\tvar raw map[string]any\n\tif err := yaml.Unmarshal(b, &raw); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal generation options from yaml: %w\", err)\n\t}\n\tjsonBytes, err := json.Marshal(raw)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal generation options map: %w\", err)\n\t}\n\tg.GenerationOptions = &geminidataanalyticspb.GenerationOptions{}\n\tif err := protojson.Unmarshal(jsonBytes, g.GenerationOptions); err != nil {\n\t\treturn fmt.Errorf(\"failed to unmarshal generation options to proto: %w\", err)\n\t}\n\treturn nil\n}\n\ntype Config struct {\n\ttools.ConfigBase  `yaml:\",inline\"`\n\tType              string                 `yaml:\"type\" validate:\"required\"`\n\tSource            string                 `yaml:\"source\" validate:\"required\"`\n\tLocation          string                 `yaml:\"location\" validate:\"required\"`\n\tContext           *QueryDataContext      `yaml:\"context\" validate:\"required\"`\n\tGenerationOptions *GenerationOptions     `yaml:\"generationOptions,omitempty\"`\n\tAnnotations       *tools.ToolAnnotations `yaml:\"annotations,omitempty\"`\n}\n","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudgda/cloudgda.go#L84-L120","documentation":"After successfully parsing YAML into map[string]any, UnmarshalYAML re-serializes the map to JSON via json.Marshal so protojson can consume it. This error fires if the map contains values that encoding/json cannot serialize. It is rare in practice because YAML-parsed values are almost always JSON-compatible.","triggerScenarios":"A generationOptions YAML value that decodes into a Go type json.Marshal cannot handle, e.g. very large numbers beyond float64 range, or a custom scalar decode producing an unsupported type.","commonSituations":"Extremely large integer literals (e.g. 1e309 / huge uint64) in the YAML block; exotic YAML tags or timestamps injected via custom decode hooks.","solutions":["Check numeric literals in generationOptions for out-of-range values and quote or reduce them","Ensure the generationOptions block contains only plain JSON-compatible types (maps, lists, strings, numbers, bools)","Simplify the block and re-add fields until the offending value is isolated","File an issue with the exact YAML snippet if a valid value still fails"],"exampleFix":"// before\ngenerationOptions:\n  hugeNumber: 1e400\n// after\ngenerationOptions:\n  hugeNumber: \"1e400\"","handlingStrategy":"validation","validationCode":"import (\"encoding/json\"; \"gopkg.in/yaml.v3\")\nfunc validJSONRoundTrip(b []byte) error {\n\tvar m map[string]any\n\tif err := yaml.Unmarshal(b, &m); err != nil { return err }\n\t_, err := json.Marshal(m)\n\treturn err\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep generationOptions values to plain maps, lists, strings, numbers, bools","Avoid astronomically large numeric literals in YAML configs"],"tags":["yaml","json","cloud-gemini-data-analytics"],"backgroundTag":"json-marshal-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"}