{"record":{"id":"87a30a8c16c626ae","repo":"abiosoft/colima","slug":"error-traversing-yaml-node-w","errorCode":null,"errorMessage":"error traversing yaml node: %w","messagePattern":"error traversing yaml node: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/yamlutil/yaml.go","lineNumber":59,"sourceCode":"\n\tf, err := embedded.Read(\"defaults/colima.yaml\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading config file: %w\", err)\n\t}\n\n\tif err := yaml.Unmarshal(f, &doc); err != nil {\n\t\treturn nil, fmt.Errorf(\"embedded default config is invalid yaml: %w\", err)\n\t}\n\n\tif l := len(doc.Content); l != 1 {\n\t\treturn nil, fmt.Errorf(\"unexpected error during yaml decode: doc has multiple children of len %d\", l)\n\t}\n\troot := doc.Content[0]\n\n\t// get all nodes\n\tnodeVals := map[string]*yaml.Node{}\n\tif err := traverseNode(\"\", root, nodeVals); err != nil {\n\t\treturn nil, fmt.Errorf(\"error traversing yaml node: %w\", err)\n\t}\n\n\t// get all node values\n\tstructVals := map[string]any{}\n\ttraverseConfig(\"\", conf, structVals)\n\n\t// apply values to nodes\n\tfor key, node := range nodeVals {\n\t\tval := structVals[key]\n\n\t\t// top level, ignore. except known maps.\n\t\tif node.Kind == yaml.MappingNode {\n\t\t\tswitch val.(type) {\n\t\t\tcase map[string]any:\n\t\t\tcase map[string]string:\n\n\t\t\tdefault:\n\t\t\t\tcontinue","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/util/yamlutil/yaml.go#L41-L77","documentation":"encodeYAML (util/yamlutil/yaml.go:59) walks the parsed default-config node tree with traverseNode, collecting every key path; this error wraps whatever traverseNode returned. In the current code traverseNode's only failure mode is the uneven-children mapping check (see error 298), so in practice 'error traversing yaml node' means the embedded default contains a structurally malformed mapping (odd number of Content entries, i.e. a key without a value).","triggerScenarios":"A hand-edited embedded/defaults/colima.yaml where a mapping has a dangling key with no value (odd Content length), e.g. a trailing 'key:' pair removed by a bad regex edit.","commonSituations":"Fork edits and sed/regex surgery on the defaults template; merge conflict resolution dropping half of a key/value pair; YAML minimizers that strip 'empty' values incorrectly.","solutions":["Restore the stock embedded/defaults/colima.yaml from git and reapply changes carefully","Run any YAML parser over the file — it will pinpoint the key missing its value","Prefer colima's runtime config layer over editing the embedded default","Add a unit test calling yamlutil round-trips (Save on defaults) to catch structural damage in CI"],"exampleFix":"# before (dangling key makes the mapping uneven)\nvm:\n  cpu: 4\n  memory\n\n# after\nvm:\n  cpu: 4\n  memory: 4","handlingStrategy":"fallback","validationCode":"// strict-parse the embedded default before use\nvar strict yaml.Node\nif err := yaml.Unmarshal(b, &strict); err != nil {\n    return fmt.Errorf(\"embedded defaults are structurally broken: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := util.Save(cfg, file); err != nil {\n    if strings.Contains(err.Error(), \"error traversing yaml node\") {\n        // structural damage in the embedded asset — reinstall the binary\n        return fmt.Errorf(\"colima install corrupted — reinstall: %w\", err)\n    }\n    return err\n}","preventionTips":["Treat embedded assets as code: review, lint, and CI-test every change","Restore defaults from git rather than patching in place","Report structural breakage upstream immediately — it affects all users of the build"],"tags":["yaml","traversal","embedded","internal"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}