abiosoft/colima · error
error traversing yaml node: %w
Error message
error traversing yaml node: %w
What it means
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).
Source
Thrown at util/yamlutil/yaml.go:59
f, err := embedded.Read("defaults/colima.yaml")
if err != nil {
return nil, fmt.Errorf("error reading config file: %w", err)
}
if err := yaml.Unmarshal(f, &doc); err != nil {
return nil, fmt.Errorf("embedded default config is invalid yaml: %w", err)
}
if l := len(doc.Content); l != 1 {
return nil, fmt.Errorf("unexpected error during yaml decode: doc has multiple children of len %d", l)
}
root := doc.Content[0]
// get all nodes
nodeVals := map[string]*yaml.Node{}
if err := traverseNode("", root, nodeVals); err != nil {
return nil, fmt.Errorf("error traversing yaml node: %w", err)
}
// get all node values
structVals := map[string]any{}
traverseConfig("", conf, structVals)
// apply values to nodes
for key, node := range nodeVals {
val := structVals[key]
// top level, ignore. except known maps.
if node.Kind == yaml.MappingNode {
switch val.(type) {
case map[string]any:
case map[string]string:
default:
continueView on GitHub (pinned to c3a5f9184d)
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
Example fix
# before (dangling key makes the mapping uneven) vm: cpu: 4 memory # after vm: cpu: 4 memory: 4
Defensive patterns
Strategy: fallback
Validate before calling
// strict-parse the embedded default before use
var strict yaml.Node
if err := yaml.Unmarshal(b, &strict); err != nil {
return fmt.Errorf("embedded defaults are structurally broken: %w", err)
} Try / catch
if err := util.Save(cfg, file); err != nil {
if strings.Contains(err.Error(), "error traversing yaml node") {
// structural damage in the embedded asset — reinstall the binary
return fmt.Errorf("colima install corrupted — reinstall: %w", err)
}
return err
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- embedded default config is invalid yaml: %w
- unexpected error during yaml decode: doc has multiple childr
- error reading config file: %w
- unexpected error during yaml node traversal: %w
- unexpected error during yaml node traversal: doc has multipl
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/87a30a8c16c626ae.
Report an issue: GitHub.