lima-vm/lima · error

field `provision[ ].mode` cannot set…

Error message

field `provision[%d].mode` cannot set skipDefaultDependencyResolution, only valid on scripts of type %#q

What it means

Lima validates each `provision` entry in a LimaYAML config during `limayaml.Validate`. The `skipDefaultDependencyResolution` field is only meaningful for provisioning scripts whose `mode` is `dependency`; it tells Lima whether to skip installing the built-in default dependency list for dependency-mode scripts. Setting it on a script of any other mode (system, user, boot, data, ansible, yq) is rejected because the field would be silently ignored, so validation fails fast instead.

Solutions

  1. Remove the skipDefaultDependencyResolution key from the provision entry that is not mode: dependency.
  2. If dependency-resolution control was intended, change the entry's mode to "dependency" and keep the field.
  3. Re-run limactl start/template validate to confirm the config passes.

Example fix

# before
provision:
  - mode: user
    script: echo hi
    skipDefaultDependencyResolution: true
# after
provision:
  - mode: user
    script: echo hi
Defensive patterns

Strategy: validation

Validate before calling

for i, p := range cfg.Provision {
	if p.Mode != "dependency" && p.SkipDefaultDependencyResolution != nil {
		return fmt.Errorf("provision[%d]: skipDefaultDependencyResolution requires mode: dependency", i)
	}
}

Type guard

func canSetSkipDepResolution(p limatype.Provision) bool {
	return p.Mode == limatype.ProvisionModeDependency
}

Try / catch

if err := limayaml.Validate(y, false, "config.yaml"); err != nil {
	var joined interface{ Unwrap() []error }
	if errors.As(err, &joined) { /* report each provision field error */ }
	return fmt.Errorf("invalid lima config: %w", err)
}

Prevention

When it happens

Trigger: Calling any entry point that runs validation (limactl create/start/restart/edit, limactl clone/rename, limactl apply, limactl template validate/args) on a YAML where a provision entry has mode other than "dependency" but a non-nil skipDefaultDependencyResolution field, e.g. `provision: - mode: user skipDefaultDependencyResolution: false`.

Common situations: Copying the skipDefaultDependencyResolution key from a dependency-mode example into a regular script block; forgetting to also change mode to "dependency" when converting an entry; YAML anchors/merge keys that carry the field into other provision entries; editor auto-completion suggesting the field for all provision modes.

Related errors


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

Appendix: source

Thrown at pkg/limayaml/validate.go:207

	// y.Firmware.LegacyBIOS is ignored for aarch64, but not a fatal error.

	for i, p := range y.Provision {
		if p.File != nil {
			if p.File.URL != "" {
				errs = errors.Join(errs, fmt.Errorf("field `provision[%d].file.url` must be empty during validation (script should already be embedded)", i))
			}
			if p.File.Digest != nil {
				errs = errors.Join(errs, fmt.Errorf("field `provision[%d].file.digest` support is not yet implemented", i))
			}
		}
		switch p.Mode {
		case limatype.ProvisionModeSystem, limatype.ProvisionModeUser, limatype.ProvisionModeBoot, limatype.ProvisionModeData, limatype.ProvisionModeDependency, limatype.ProvisionModeAnsible, limatype.ProvisionModeYQ:
		default:
			errs = errors.Join(errs, fmt.Errorf("field `provision[%d].mode` must one of %#q, %#q, %#q, %#q, %#q, %#q, or %#q",
				i, limatype.ProvisionModeSystem, limatype.ProvisionModeUser, limatype.ProvisionModeBoot, limatype.ProvisionModeData, limatype.ProvisionModeDependency, limatype.ProvisionModeAnsible, limatype.ProvisionModeYQ))
		}
		if p.Mode != limatype.ProvisionModeDependency && p.SkipDefaultDependencyResolution != nil {
			errs = errors.Join(errs, fmt.Errorf("field `provision[%d].mode` cannot set skipDefaultDependencyResolution, only valid on scripts of type %#q",
				i, limatype.ProvisionModeDependency))
		}

		if *y.OS == limatype.WINDOWS && (p.Mode == limatype.ProvisionModeAnsible || p.Mode == limatype.ProvisionModeBoot || p.Mode == limatype.ProvisionModeYQ) {
			errs = errors.Join(errs, fmt.Errorf("provision mode %#q is not supported on Windows VM", p.Mode))
		}

		// This can lead to fatal Panic if p.Path is nil, better to return an error here
		switch p.Mode {
		case limatype.ProvisionModeData, limatype.ProvisionModeYQ:
			if p.Path == nil {
				errs = errors.Join(errs, fmt.Errorf("field `provision[%d].path` must not be empty when mode is %#q", i, p.Mode))
				return errs
			}
			if !path.IsAbs(*p.Path) {
				errs = errors.Join(errs, fmt.Errorf("field `provision[%d].path` must be an absolute path", i))
			}
			if p.Mode == limatype.ProvisionModeData && p.Content == nil {

View on GitHub (pinned to dd909d0973)