{"record":{"id":"1d9b3b1347116cfc","repo":"googleapis/mcp-toolbox","slug":"unable-to-parse-yaml-s","errorCode":null,"errorMessage":"unable to parse YAML: %s","messagePattern":"unable to parse YAML: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"internal/server/config.go","lineNumber":185,"sourceCode":"type GroupConfigs map[string]group.GroupConfig\n\nfunc UnmarshalPrimitiveConfig(ctx context.Context, raw []byte) (SourceConfigs, AuthServiceConfigs, EmbeddingModelConfigs, ToolConfigs, PromptConfigs, GroupConfigs, error) {\n\t// prepare configs map\n\tvar sourceConfigs SourceConfigs\n\tvar authServiceConfigs AuthServiceConfigs\n\tvar embeddingModelConfigs EmbeddingModelConfigs\n\tvar toolConfigs ToolConfigs\n\tvar promptConfigs PromptConfigs\n\tvar groupConfigs GroupConfigs\n\t// Legacy `kind: toolset` configs are collected here as tools-only groups, then\n\t// folded into groupConfigs after the loop so explicit `kind: group` definitions\n\t// take precedence regardless of document order.\n\tvar toolsetGroups map[string]group.GroupConfig\n\t// promptset configs is not yet supported\n\n\tfile, err := parser.ParseBytes(raw, 0)\n\tif err != nil {\n\t\treturn nil, nil, nil, nil, nil, nil, fmt.Errorf(\"unable to parse YAML: %s\", yaml.FormatError(err, false, false))\n\t}\n\n\tdecoder := yaml.NewDecoder(bytes.NewReader(raw))\n\tfor index, doc := range file.Docs {\n\t\tif doc == nil || doc.Body == nil {\n\t\t\tcontinue\n\t\t}\n\t\tdocIndex := index + 1\n\t\tvar resource map[string]any\n\t\tif err := decoder.DecodeFromNodeContext(ctx, doc.Body, &resource); err != nil {\n\t\t\tif len(file.Docs) > 1 {\n\t\t\t\treturn nil, nil, nil, nil, nil, nil, fmt.Errorf(\"document %d: %s\", docIndex, yaml.FormatError(err, false, false))\n\t\t\t}\n\t\t\treturn nil, nil, nil, nil, nil, nil, fmt.Errorf(\"unable to decode YAML document: %s\", yaml.FormatError(err, false, false))\n\t\t}\n\t\tvar kind, name string\n\t\tvar ok bool\n\t\tif kind, ok = resource[\"kind\"].(string); !ok {","sourceCodeStart":167,"sourceCodeEnd":203,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/server/config.go#L167-L203","documentation":"UnmarshalPrimitiveConfig parses the raw tools.yaml bytes with the yaml parser (goccy/go-yaml). If parser.ParseBytes fails, the whole config cannot be read and the server aborts with this error, which embeds the formatted YAML error including line/column context.","triggerScenarios":"Loading a tools.yaml with syntax errors: bad indentation, tabs instead of spaces, unquoted special characters (@, *, :) at value start, unterminated strings, or invalid YAML anchors.","commonSituations":"Hand-edited YAML configs, copy-pasting config from docs with wrong indentation, editor inserting tabs, missing space after a colon, unescaped template characters.","solutions":["Read the formatted error for the exact line/column and fix the YAML syntax there","Replace tabs with spaces and fix indentation to consistent 2-space steps","Quote values that begin with special YAML characters (e.g. '*', '@', ':')","Validate the file with a YAML linter or `toolbox --tools-file my.yaml` before deploying"],"exampleFix":"// before\nsources:\n\tmy-pg:\n\tkind: postgres\n// after\nsources:\n  my-pg:\n    kind: postgres","handlingStrategy":"validation","validationCode":"const yaml = require('yaml');\ntry { yaml.parse(fs.readFileSync('tools.yaml', 'utf8')); }\ncatch (e) { console.error('tools.yaml syntax error:', e.message); process.exit(1); }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run a YAML linter in CI on tools files","Use spaces, never tabs, for indentation","Quote values starting with special YAML characters","Start the server with the config before deploying"],"tags":["yaml","config","startup","syntax"],"backgroundTag":"yaml-parse-error","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"}