abiosoft/colima · error
unexpected error during yaml node traversal: %w
Error message
unexpected error during yaml node traversal: %w
What it means
encodeYAML (util/yamlutil/yaml.go:95) roundtrips each value: bytes just produced by yaml.Marshal are immediately Unmarshaled into a yaml.Node; this error wraps that Unmarshal. Since the input is output of the same yaml.v3 library, this failure is effectively an unreachable internal invariant — it would require Marshal to emit invalid YAML. Encountering it points to memory corruption or an inconsistent yaml.v3 version mismatch in the build.
Source
Thrown at util/yamlutil/yaml.go:95
continue
}
}
// nil slices are converted to untyped nil to encode as `null` instead of `[]`.
// this preserves nil vs empty slice distinction when the yaml is loaded back.
if v := reflect.ValueOf(val); v.Kind() == reflect.Slice && v.IsNil() {
val = nil
}
// lazy way, delegate node construction to the yaml library via a roundtrip.
// no performance concern as only one file is being read
b, err := yaml.Marshal(val)
if err != nil {
return nil, fmt.Errorf("unexpected error nested value encoding: %w", err)
}
var newNode yaml.Node
if err := yaml.Unmarshal(b, &newNode); err != nil {
return nil, fmt.Errorf("unexpected error during yaml node traversal: %w", err)
}
if l := len(newNode.Content); l != 1 {
return nil, fmt.Errorf("unexpected error during yaml node traversal: doc has multiple children of len %d", l)
}
*node = *newNode.Content[0]
}
b, err := encode(root)
if err != nil {
return nil, fmt.Errorf("error encoding yaml file: %w", err)
}
return b, nil
}
func traverseConfig(parentKey string, s any, vals map[string]any) {
typ := reflect.TypeOf(s)View on GitHub (pinned to c3a5f9184d)
Solutions
- Rebuild with the stock gopkg.in/yaml.v3 dependency (go mod tidy, remove vendored forks)
- Report upstream — include the wrapped underlying error, which identifies what yaml rejected
- If it flaps intermittently, check for concurrent config mutation and guard saves with a mutex
- Reinstall the official binary to rule out local corruption
Defensive patterns
Strategy: try-catch
Try / catch
if err := util.Save(cfg, file); err != nil {
if strings.Contains(err.Error(), "yaml node traversal") {
// internal invariant: capture diagnostics, then reinstall/report upstream
}
return err
} Prevention
- Pin gopkg.in/yaml.v3 to the version colima builds with
- Avoid vendored forks of the yaml library
- Keep config saves single-threaded (mutex) to rule out data races
When it happens
Trigger: No legitimate runtime input reaches this line; only a corrupted process, a patched/incompatible gopkg.in/yaml.v3 replacement, or a bug in a vendored fork of the yaml library triggers it.
Common situations: Vendored forks of yaml.v3 with divergent behavior; binary corruption; experimental reflect-based value mutation happening concurrently during config save (data race producing garbage bytes).
Related errors
- unexpected error during yaml node traversal: doc has multipl
- embedded default config is invalid yaml: %w
- unexpected error during yaml decode: doc has multiple childr
- error traversing yaml node: %w
- error encoding yaml file: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/6ca5fd19b81450fc.
Report an issue: GitHub.