{"record":{"id":"797c3ca59ec94879","repo":"lima-vm/lima","slug":"field-provision-d-mode-cannot-set-skipdefaultd","errorCode":null,"errorMessage":"field `provision[%d].mode` cannot set skipDefaultDependencyResolution, only valid on scripts of type %#q","messagePattern":"field `provision\\[(.+?)\\]\\.mode` cannot set skipDefaultDependencyResolution, only valid on scripts of type %#q","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":207,"sourceCode":"\t// y.Firmware.LegacyBIOS is ignored for aarch64, but not a fatal error.\n\n\tfor i, p := range y.Provision {\n\t\tif p.File != nil {\n\t\t\tif p.File.URL != \"\" {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].file.url` must be empty during validation (script should already be embedded)\", i))\n\t\t\t}\n\t\t\tif p.File.Digest != nil {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].file.digest` support is not yet implemented\", i))\n\t\t\t}\n\t\t}\n\t\tswitch p.Mode {\n\t\tcase limatype.ProvisionModeSystem, limatype.ProvisionModeUser, limatype.ProvisionModeBoot, limatype.ProvisionModeData, limatype.ProvisionModeDependency, limatype.ProvisionModeAnsible, limatype.ProvisionModeYQ:\n\t\tdefault:\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].mode` must one of %#q, %#q, %#q, %#q, %#q, %#q, or %#q\",\n\t\t\t\ti, limatype.ProvisionModeSystem, limatype.ProvisionModeUser, limatype.ProvisionModeBoot, limatype.ProvisionModeData, limatype.ProvisionModeDependency, limatype.ProvisionModeAnsible, limatype.ProvisionModeYQ))\n\t\t}\n\t\tif p.Mode != limatype.ProvisionModeDependency && p.SkipDefaultDependencyResolution != nil {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].mode` cannot set skipDefaultDependencyResolution, only valid on scripts of type %#q\",\n\t\t\t\ti, limatype.ProvisionModeDependency))\n\t\t}\n\n\t\tif *y.OS == limatype.WINDOWS && (p.Mode == limatype.ProvisionModeAnsible || p.Mode == limatype.ProvisionModeBoot || p.Mode == limatype.ProvisionModeYQ) {\n\t\t\terrs = errors.Join(errs, fmt.Errorf(\"provision mode %#q is not supported on Windows VM\", p.Mode))\n\t\t}\n\n\t\t// This can lead to fatal Panic if p.Path is nil, better to return an error here\n\t\tswitch p.Mode {\n\t\tcase limatype.ProvisionModeData, limatype.ProvisionModeYQ:\n\t\t\tif p.Path == nil {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].path` must not be empty when mode is %#q\", i, p.Mode))\n\t\t\t\treturn errs\n\t\t\t}\n\t\t\tif !path.IsAbs(*p.Path) {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].path` must be an absolute path\", i))\n\t\t\t}\n\t\t\tif p.Mode == limatype.ProvisionModeData && p.Content == nil {","sourceCodeStart":189,"sourceCodeEnd":225,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L189-L225","documentation":"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.","triggerScenarios":"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\n  skipDefaultDependencyResolution: false`.","commonSituations":"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.","solutions":["Remove the skipDefaultDependencyResolution key from the provision entry that is not mode: dependency.","If dependency-resolution control was intended, change the entry's mode to \"dependency\" and keep the field.","Re-run limactl start/template validate to confirm the config passes."],"exampleFix":"# before\nprovision:\n  - mode: user\n    script: echo hi\n    skipDefaultDependencyResolution: true\n# after\nprovision:\n  - mode: user\n    script: echo hi","handlingStrategy":"validation","validationCode":"for i, p := range cfg.Provision {\n\tif p.Mode != \"dependency\" && p.SkipDefaultDependencyResolution != nil {\n\t\treturn fmt.Errorf(\"provision[%d]: skipDefaultDependencyResolution requires mode: dependency\", i)\n\t}\n}","typeGuard":"func canSetSkipDepResolution(p limatype.Provision) bool {\n\treturn p.Mode == limatype.ProvisionModeDependency\n}","tryCatchPattern":"if err := limayaml.Validate(y, false, \"config.yaml\"); err != nil {\n\tvar joined interface{ Unwrap() []error }\n\tif errors.As(err, &joined) { /* report each provision field error */ }\n\treturn fmt.Errorf(\"invalid lima config: %w\", err)\n}","preventionTips":["Only set skipDefaultDependencyResolution inside dependency-mode blocks.","Use limactl template validate in CI on every template change.","Avoid YAML anchors that merge dependency-specific keys into other provision entries."],"tags":["lima","limayaml","validation","provision"],"backgroundTag":"invalid-config-field-combination","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}