{"record":{"id":"0e0cd4cd96827210","repo":"lima-vm/lima","slug":"provision-mode-q-is-not-supported-on-windows-vm","errorCode":null,"errorMessage":"provision mode %#q is not supported on Windows VM","messagePattern":"provision mode %#q is not supported on Windows VM","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/limayaml/validate.go","lineNumber":212,"sourceCode":"\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 {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].content` must not be empty when mode is %#q\", i, p.Mode))\n\t\t\t}\n\t\t\tif p.Mode == limatype.ProvisionModeYQ && p.Expression == nil {\n\t\t\t\terrs = errors.Join(errs, fmt.Errorf(\"field `provision[%d].expression` must not be empty when mode is %#q\", i, p.Mode))\n\t\t\t}","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/limayaml/validate.go#L194-L230","documentation":"During `limayaml.Validate`, Lima rejects provisioning scripts whose mode is unsupported on a Windows guest VM. Modes `ansible`, `boot`, and `yq` rely on guest capabilities (ansible provisioning, boot-time hooks, yq expression evaluation) that are not implemented for `os: windows` templates, so validation errors out before the VM is created.","triggerScenarios":"Running limactl create/start/template validate (or edit/restart/apply/clone/rename, all of which call Validate) on a template where `os: windows` and at least one provision entry has mode \"ansible\", \"boot\", or \"yq\".","commonSituations":"Porting a Linux template to Windows by only changing os: windows while keeping the original provision modes; a shared base template with boot-mode scripts reused for a Windows instance; adding a yq-mode file edit step to a Windows template without realizing the restriction.","solutions":["Change os to \"linux\" if the workload does not actually require Windows.","Remove or convert the ansible/boot/yq provision entries to supported modes (e.g. mode: user or system scripts) for the Windows template.","Split the config: keep Windows-specific provisioning in mode: user/system scripts and move yq/ansible logic to the host side."],"exampleFix":"# before\nos: windows\nprovision:\n  - mode: boot\n    script: echo booting\n# after\nos: windows\nprovision:\n  - mode: user\n    script: echo starting","handlingStrategy":"validation","validationCode":"if cfg.OS != nil && *cfg.OS == \"windows\" {\n\tfor i, p := range cfg.Provision {\n\t\tswitch p.Mode {\n\t\tcase \"ansible\", \"boot\", \"yq\":\n\t\t\treturn fmt.Errorf(\"provision[%d]: mode %q unsupported on windows\", i, p.Mode)\n\t\t}\n\t}\n}","typeGuard":"func provisionModeWindowsSafe(mode limatype.ProvisionMode) bool {\n\treturn mode != limatype.ProvisionModeAnsible && mode != limatype.ProvisionModeBoot && mode != limatype.ProvisionModeYQ\n}","tryCatchPattern":"if err := limayaml.Validate(y, false, \"template.yaml\"); err != nil {\n\tif strings.Contains(err.Error(), \"not supported on Windows VM\") {\n\t\treturn fmt.Errorf(\"template targets windows; migrate offending provision entries: %w\", err)\n\t}\n\treturn err\n}","preventionTips":["Keep a separate windows variant of shared templates with only user/system/data provision modes.","Run limactl template validate with the target os before distribution.","Document that ansible, boot, and yq provision modes are Linux-guest only."],"tags":["lima","limayaml","windows","provision"],"backgroundTag":"unsupported-platform-feature","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}