abiosoft/colima · error
embedded default config is invalid yaml: %w
Error message
embedded default config is invalid yaml: %w
What it means
encodeYAML (util/yamlutil/yaml.go:48) unmarshals the embedded defaults/colima.yaml into a yaml.Node; failure means the asset bytes are not valid YAML (tabs for indentation, unclosed quotes, bad anchors). Because the file ships inside the binary and is YAML-validated in the stock repo, hitting this means the embedded content in your binary was corrupted or hand-edited into invalid YAML — an internal invariant, not a runtime condition.
Source
Thrown at util/yamlutil/yaml.go:48
return err
}
if err := os.WriteFile(file, b, 0644); err != nil {
return fmt.Errorf("error writing yaml file: %w", err)
}
return nil
}
func encodeYAML(conf config.Config) ([]byte, error) {
var doc yaml.Node
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 nodesView on GitHub (pinned to c3a5f9184d)
Solutions
- Validate the file locally: `python -c 'import yaml,sys; yaml.safe_load(open("embedded/defaults/colima.yaml"))'` or any YAML linter, then fix the syntax error it reports
- Revert local edits to embedded/defaults/colima.yaml and change defaults via colima's config layer instead
- Reinstall the stock binary if you did not build it yourself
- Add a CI test that yaml.Unmarshal's the embedded asset on every commit
Example fix
# embedded/defaults/colima.yaml (before) — tab indentation breaks YAML vm: cpu: 4 # after vm: cpu: 4
Defensive patterns
Strategy: fallback
Validate before calling
// CI guard for forks: embedded defaults must stay valid YAML
func TestEmbeddedDefaultsAreValidYAML(t *testing.T) {
b, err := embedded.Read("defaults/colima.yaml")
if err != nil { t.Fatal(err) }
var doc yaml.Node
if err := yaml.Unmarshal(b, &doc); err != nil { t.Fatalf("defaults broken: %v", err) }
} Try / catch
if err := util.Save(cfg, file); err != nil {
if strings.Contains(err.Error(), "invalid yaml") {
// the binary's embedded asset is corrupt: reinstall, don't retry
return fmt.Errorf("colima binary corrupted — reinstall: %w", err)
}
return err
} Prevention
- Never hand-edit embedded/defaults/colima.yaml without a YAML lint step
- Change defaults through colima's config layer, not the embedded file
- Use spaces (never tabs) in embedded YAML
- Run the round-trip Save() test in CI
When it happens
Trigger: A fork edit to embedded/defaults/colima.yaml introduced invalid YAML (e.g. a tab, an unterminated string) and the binary was rebuilt; a corrupted embedded FS produced garbage bytes.
Common situations: Fork maintainers tweaking default settings directly in the embedded template; merge conflicts resolved badly in the defaults file; encoding changes (BOM, CRLF) introduced by editors breaking strict YAML.
Related errors
- unexpected error during yaml decode: doc has multiple childr
- error traversing yaml node: %w
- config load failed: %w
- error reading config file: %w
- unexpected error during yaml node traversal: %w
AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15).
Data as JSON: /api/errors/4fed601fe27846a3.
Report an issue: GitHub.