lima-vm/lima · critical
failed to validate the instance YAML after filling defaults:
Error message
failed to validate the instance YAML after filling defaults: %w
What it means
After creating the driver, HostAgent.New re-runs limayaml.Validate on the instance config with warnings enabled, verifying the YAML is still valid once defaults are filled in. Failure means the defaulted config violates the Lima schema or semantic constraints; the error is wrapped with this message.
Source
Thrown at pkg/hostagent/hostagent.go:174
var udpDNSLocalPort, tcpDNSLocalPort int
if limayaml.HostResolverEnabled(inst.Config) {
udpDNSLocalPort, err = freeport.UDP()
if err != nil {
return nil, err
}
tcpDNSLocalPort, err = freeport.TCP()
if err != nil {
return nil, err
}
}
limaDriver, err := driverutil.CreateConfiguredDriver(ctx, inst, sshLocalPort)
if err != nil {
return nil, fmt.Errorf("failed to create driver instance: %w", err)
}
if err := limayaml.Validate(inst.Config, true); err != nil {
return nil, fmt.Errorf("failed to validate the instance YAML after filling defaults: %w", err)
}
sshLocalPort = inst.SSHLocalPort
info := limaDriver.Info(ctx)
vSockPort := info.VsockPort
virtioPort := info.VirtioPort
noCloudInit := info.Features.NoCloudInit
rosettaEnabled := info.Features.RosettaEnabled
rosettaBinFmt := info.Features.RosettaBinFmt
// Disable Rosetta in Plain mode
if *inst.Config.Plain {
rosettaEnabled = false
rosettaBinFmt = false
}
var iid string
switch *inst.Config.OS {View on GitHub (pinned to dd909d0973)
Solutions
- Read the wrapped limayaml validation error — it names the exact offending field and constraint
- Fix the invalid field in ~/.lima/<instance>/lima.yaml (or the source template and re-provision)
- Run 'limactl validate <file>' on your YAML before starting to catch issues early
- Ensure the limactl binary version matches the Lima version that created the instance
Example fix
// before (lima.yaml) cpus: "four" // after cpus: 4
Defensive patterns
Strategy: validation
Validate before calling
// pre-validate the config before starting the instance
yamlBytes, _ := os.ReadFile("~/.lima/default/lima.yaml")
y, err := limayaml.Load(yamlBytes, "<file>")
if err != nil { return err }
if err := limayaml.Validate(limayaml.FillDefaults(y), true); err != nil {
return fmt.Errorf("config invalid before start: %w", err)
} Try / catch
err := limayaml.Validate(inst.Config, true)
if err != nil {
// surface field-level errors to the user instead of a generic start failure
return fmt.Errorf("fix lima.yaml: %w", err)
} Prevention
- Run 'limactl validate <file>' after every YAML edit
- Avoid hand-editing instance YAML in ~/.lima; edit the source template and re-provision
- Use matching Lima versions across machines sharing configs
- Keep field names/values from the official schema docs, not guesses
When it happens
Trigger: limactl start (via hostagentAction → hostagent.New) on an instance whose lima.yaml — after ApplyDefaults — fails validation: invalid enum values, contradictory fields, out-of-range numbers, or invalid combinations of plain/mount/disk settings.
Common situations: Hand-edited lima.yaml introducing an invalid value; config produced by a newer Lima version then loaded by an older limactl; template merge producing conflicting fields; typos in field names that default wrongly.
Understand the failure class
Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.
Related errors
- the YAML is invalid, saved the buffer as %#q: %w
- failed to validate YAML file %#q: %w
- failed to validate the instance YAML after filling defaults:
- failed to validate the instance YAML after filling defaults:
- the YAML is invalid, attempted to save the buffer as %#q but
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/1e7a5aa767d37367.
Report an issue: GitHub.