{"record":{"id":"8286a04018cc4ed5","repo":"lima-vm/lima","slug":"failed-to-create-driver-instance-w-8286a0","errorCode":null,"errorMessage":"failed to create driver instance: %w","messagePattern":"failed to create driver instance: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/instance/delete.go","lineNumber":42,"sourceCode":"\n\tStopForcibly(inst)\n\n\tif len(inst.Errors) == 0 {\n\t\tif err := unregister(ctx, inst); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to unregister %#q: %w\", inst.Dir, err)\n\t\t}\n\t}\n\tif err := os.RemoveAll(inst.Dir); err != nil {\n\t\treturn fmt.Errorf(\"failed to remove %#q: %w\", inst.Dir, err)\n\t}\n\n\treturn nil\n}\n\nfunc unregister(ctx context.Context, inst *limatype.Instance) error {\n\tlimaDriver, err := driverutil.CreateConfiguredDriver(ctx, inst, 0)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to create driver instance: %w\", err)\n\t}\n\n\tif err := limaDriver.Delete(ctx); err != nil {\n\t\treturn fmt.Errorf(\"failed to delete driver instance: %w\", err)\n\t}\n\tserver.Stop(inst.Dir, true)\n\n\treturn nil\n}\n","sourceCodeStart":24,"sourceCodeEnd":52,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/instance/delete.go#L24-L52","documentation":"The unregister helper in pkg/instance/delete.go could not construct the VM driver via driverutil.CreateConfiguredDriver. Without a driver instance, Lima cannot tell the driver to delete its resources, so instance teardown aborts. This mirrors error 641 but on the delete path.","triggerScenarios":"unregister(ctx, inst) (called from Delete when inst.Errors is empty) hits CreateConfiguredDriver(ctx, inst, 0) returning an error — missing/unsupported driver for inst.Config's vmType, or driver configure failure reading the instance dir.","commonSituations":"Deleting an instance created with a vmType unavailable on the current machine (moved between macOS/Linux), a limactl build lacking the driver, or corrupted lima.yaml in the instance directory.","solutions":["Check the wrapped driver error for the missing/unsupported driver name.","Ensure lima.yaml in the instance dir is intact and its vmType is supported on this host.","Install/rebuild limactl with the needed driver (`make native`).","If the driver can never work again, force-remove the directory manually after `limactl stop -f`."],"exampleFix":"// before: instance made on macOS with vmType: vz, deleting on Linux\nvmType: \"vz\"\n// after: edit instance dir lima.yaml or delete on the original host\nvmType: \"qemu\"","handlingStrategy":"fallback","validationCode":"// verify the driver for the instance's vmType is registered on this host\nif !driverutil.IsDriverRegistered(inst.Config.VMType) {\n    return fmt.Errorf(\"driver %s unavailable; delete on original host or clean manually\", inst.Config.VMType)\n}","typeGuard":null,"tryCatchPattern":"if err := instance.Delete(ctx, inst, false); err != nil {\n    if strings.Contains(err.Error(), \"failed to create driver instance\") {\n        // driver can never load here: fall back to manual dir removal\n        return os.RemoveAll(inst.Dir)\n    }\n    return err\n}","preventionTips":["Delete instances on the same OS/arch where they were created","Install all external drivers you use across machines","Back up instance lima.yaml before manual cleanup"],"tags":["driver","unregister","instance-delete"],"backgroundTag":"driver-initialization-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}