{"record":{"id":"80de3a98d6092e1e","repo":"lima-vm/lima","slug":"failed-to-resolve-vm-for-q-w","errorCode":null,"errorMessage":"failed to resolve vm for %#q: %w","messagePattern":"failed to resolve vm for %#q: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/restart.go","lineNumber":95,"sourceCode":"\n\tyqExprs, err := editflags.YQExpressions(flags, false, params)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif len(yqExprs) > 0 {\n\t\tyq := yqutil.Join(yqExprs)\n\t\tyBytes, err := yqutil.EvaluateExpression(ctx, yq, yContent)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif !bytes.Equal(yBytes, yContent) {\n\t\t\ty, err := limayaml.LoadWithWarnings(ctx, yBytes, filePath)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := driverutil.ResolveVMType(y); err != nil {\n\t\t\t\treturn fmt.Errorf(\"failed to resolve vm for %#q: %w\", filePath, err)\n\t\t\t}\n\t\t\tinst.Config = y\n\t\t\tlimaDriver, err := driverutil.CreateConfiguredDriver(ctx, inst, 0)\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tif err := limaDriver.Validate(ctx); err != nil {\n\t\t\t\treturn saveRejectedYAML(yBytes, err)\n\t\t\t}\n\t\t\tif err := limayaml.Validate(inst.Config, true); err != nil {\n\t\t\t\treturn saveRejectedYAML(yBytes, err)\n\t\t\t}\n\t\t\tif err := limayaml.ValidateAgainstLatestConfig(ctx, yBytes, yContent); err != nil {\n\t\t\t\treturn saveRejectedYAML(yBytes, err)\n\t\t\t}\n\t\t\tif err := os.WriteFile(filePath, yBytes, 0o644); err != nil {\n\t\t\t\treturn err\n\t\t\t}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/restart.go#L77-L113","documentation":"When restarting, restart.go re-reads the instance's lima.yaml; if the file content changed it reloads it with limayaml.LoadWithWarnings and then calls driverutil.ResolveVMType to determine the VM driver. If the (modified) config cannot be resolved to a VM type, the command aborts with \"failed to resolve vm for <file>\" wrapping the resolver error.","triggerScenarios":"Hand-editing an instance's lima.yaml (or applying a yq/template change) so that the vm-type/arch fields are missing, ambiguous, or unsupported, then running `limactl restart <instance>`.","commonSituations":"Manual edits removing the `vmType` setting; copying a config from a different host/architecture; template upgrades changing schema; typos in driver names.","solutions":["Restore a valid vmType in the instance's lima.yaml (e.g. `vmType: qemu` or the native driver for your OS)","Revert recent manual edits to ~/.lima/<instance>/lima.yaml or re-apply them with a supported vmType","Validate the edited file by loading it via a fresh `limactl start`/edit flow, then restart"],"exampleFix":"// before\n# ~/.lima/myvm/lima.yaml (vmType removed by hand-edit)\n// after\nvmType: qemu\narch: x86_64","handlingStrategy":"validation","validationCode":"vmType=$(yq '.vmType' ~/.lima/myvm/lima.yaml)\ncase \"$vmType\" in qemu|vz|wsl2|qemu-system-*) : ;; *) echo \"unsupported vmType: $vmType\" >&2; exit 1;; esac","typeGuard":null,"tryCatchPattern":"if err := restartCmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"failed to resolve vm for\") {\n        // restore a valid vmType in the instance lima.yaml, then retry\n    }\n}","preventionTips":["Edit instance configs via `limactl edit` rather than raw file edits","Preserve the vmType/arch fields when hand-editing lima.yaml","Validate copied configs against the target host's supported drivers"],"tags":["restart","vm-type","config"],"backgroundTag":"vm-type-resolution-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}