{"record":{"id":"e6b7bee9cf1443cf","repo":"googleapis/mcp-toolbox","slug":"failed-to-unmarshal-generation-options-from-yaml","errorCode":null,"errorMessage":"failed to unmarshal generation options from yaml: %w","messagePattern":"failed to unmarshal generation options from yaml: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/tools/cloudgda/cloudgda.go","lineNumber":98,"sourceCode":"\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to marshal context map: %w\", err)\n\t}\n\tq.QueryDataContext = &geminidataanalyticspb.QueryDataContext{}\n\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\"`","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/tools/cloudgda/cloudgda.go#L80-L116","documentation":"This error is returned by GenerationOptions.UnmarshalYAML when the YAML bytes for the generationOptions block cannot be parsed into a generic map. The tool first tries yaml.Unmarshal into map[string]any; any YAML syntax error (bad indentation, tabs, duplicate keys, invalid scalars) is wrapped with this message. It indicates the tools.yaml config itself is malformed, not an API/runtime failure.","triggerScenarios":"Declaring a cloudgda tool in tools.yaml where the generationOptions value has invalid YAML syntax: tabs instead of spaces, unbalanced quotes or brackets, or a scalar where a mapping is expected (e.g. generationOptions: someString).","commonSituations":"Hand-editing tools.yaml and breaking indentation; pasting generationOptions from JSON with mismatched quoting; copy-paste introducing tabs; YAML anchors/merge keys mishandled; special characters like '@' or ':' unquoted.","solutions":["Run the YAML through a linter/parser (yq or yamlfmt) to find the exact syntax error at the reported line","Fix indentation to use consistent 2-space indentation, no tabs","Quote scalar values that contain special YAML characters (:, -, #, @, {)","If the value is a nested block, ensure generationOptions is followed by indented child keys, not an inline scalar"],"exampleFix":"// before (invalid YAML: tabs and unquoted colon)\ngenerationOptions:\n\tqueryMode: AUTO\n\tproject: my:project\n// after\ngenerationOptions:\n  queryMode: AUTO\n  project: \"my:project\"","handlingStrategy":"validation","validationCode":"import \"gopkg.in/yaml.v3\"\nfunc validYAML(b []byte) error {\n\tvar m map[string]any\n\treturn yaml.Unmarshal(b, &m)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Lint tools.yaml with yq or a YAML formatter before starting the server","Use spaces, never tabs, in YAML files","Quote scalars containing : # @ { } characters"],"tags":["yaml","config","cloud-gemini-data-analytics"],"backgroundTag":"yaml-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"}