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

  1. Read the inner validation message; it lists the exact offending field.
  2. Run `limactl edit <inst>` (or `limactl start <inst>` interactive editor) and fix the reported field.
  3. Validate the template file standalone before applying: `limactl start ./template.yaml` on a fresh instance or limayaml lint equivalents.
  4. 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

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


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/ff0db0db9fba910e. Report an issue: GitHub.