lima-vm/lima · error
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 CreateConfiguredDriver fills in defaults, Prepare re-validates the full instance YAML with limayaml.Validate(inst.Config, true). This catches config that only becomes invalid after defaults are applied (conflicting fields, out-of-range values, missing images, etc.). The error wraps the validation details.
Source
Thrown at pkg/instance/start.go:79
case limatype.FREEBSD, limatype.WINDOWS:
// guest agent is not implemented for FreeBSD and Windows yet
needsGuestAgent = false
default:
needsGuestAgent = !*inst.Config.Plain
}
if needsGuestAgent && guestAgent == "" {
var err error
guestAgent, err = usrlocal.GuestAgentBinary(*inst.Config.OS, *inst.Config.Arch)
if err != nil {
return nil, err
}
}
limaDriver, err := driverutil.CreateConfiguredDriver(ctx, inst, 0)
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)
}
if err := limaDriver.Validate(ctx); err != nil {
return nil, err
}
if err := limaDriver.Create(ctx); err != nil {
return nil, err
}
// Migrate legacy disk layout (diffdisk → disk, ISO basedisk → iso)
if err := driverutil.MigrateDiskLayout(inst.Dir); err != nil {
return nil, err
}
supportedImageFormats := limaDriver.Info(ctx).Features.SupportedImageFormats
created := limayaml.IsExistingInstanceDir(inst.Dir)View on GitHub (pinned to dd909d0973)
Solutions
- Read the inner validation message; it lists the exact offending field.
- Run `limactl edit <inst>` (or `limactl start <inst>` interactive editor) and fix the reported field.
- Validate the template file standalone before applying: `limactl start ./template.yaml` on a fresh instance or limayaml lint equivalents.
- If an upgrade introduced it, compare against the release notes and migrate the deprecated field.
Example fix
// before (lima.yaml) cpus: "four" // after cpus: 4
Defensive patterns
Strategy: validation
Validate before calling
// validate the instance config the same way Prepare does, before starting
y, err := limayaml.Load(o.Paths.LimaYAML, "default")
if err != nil { return err }
if err := limayaml.Validate(y, true); err != nil {
return fmt.Errorf("instance config invalid: %w", err)
} Prevention
- Always edit via `limactl edit` so validation runs on save
- Re-validate existing instances after Lima upgrades
- Avoid hand-editing ~/.lima/<inst>/lima.yaml with schema knowledge only from old docs
- Test new templates on a throwaway instance before production
When it happens
Trigger: Calling limactl start (Start -> StartWithPaths -> Prepare) with an instance whose resolved lima.yaml violates schema/constraints - e.g. invalid arch, mounts pointing outside allowed dirs, cpus/memory misformatted, or defaults yielding an invalid combination.
Common situations: Hand-editing ~/.lima/<inst>/lima.yaml; upgrading Lima so new validation rules reject old configs; template edits via limactl edit that pass yq but fail schema validation.
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
- failed to validate the instance YAML after filling defaults:
- the YAML is invalid, saved the buffer as %#q: %w
- failed to validate YAML file %#q: %w
- field `vmOpts.qemu.minimumVersion` must be a semvar value, g
- field `mountType` must be %#q for WSL2 driver, got %#q
AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01).
Data as JSON: /api/errors/ff0db0db9fba910e.
Report an issue: GitHub.