{"record":{"id":"f04e7939205634e1","repo":"lima-vm/lima","slug":"instance-q-directory-q-exists-but-its-q-coul","errorCode":null,"errorMessage":"instance %#q directory %#q exists but its %#q could not be read; it was NOT deleted, in case it is currently being cloned into. If no `limactl` operation is using it, remove it manually","messagePattern":"instance %#q directory %#q exists but its %#q could not be read; it was NOT deleted, in case it is currently being cloned into\\. If no `limactl` operation is using it, remove it manually","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cmd/limactl/delete.go","lineNumber":85,"sourceCode":"\t}\n\tif err := reconcile.Reconcile(ctx, \"\"); err != nil {\n\t\terrs = append(errs, err)\n\t}\n\treturn errors.Join(errs...)\n}\n\nfunc warnAboutMissingInstance(instName string) error {\n\tinstDir, err := dirnames.InstanceDir(instName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif _, statErr := os.Stat(instDir); errors.Is(statErr, os.ErrNotExist) {\n\t\tlogrus.Warnf(\"Ignoring non-existent instance %#q\", instName)\n\t\treturn nil\n\t} else if statErr != nil {\n\t\treturn statErr\n\t}\n\treturn fmt.Errorf(\"instance %#q directory %#q exists but its %#q could not be read; \"+\n\t\t\"it was NOT deleted, in case it is currently being cloned into. \"+\n\t\t\"If no `limactl` operation is using it, remove it manually\",\n\t\tinstName, instDir, filenames.LimaYAML)\n}\n\nfunc deleteBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\treturn bashCompleteInstanceNames(cmd)\n}\n","sourceCodeStart":67,"sourceCodeEnd":94,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/delete.go#L67-L94","documentation":"During `limactl delete`, the instance directory exists but its lima.yaml could not be read, so Lima refuses to delete it. The directory may be mid-clone (another limactl operation is creating the instance), and deleting it would corrupt the clone. The error intentionally leaves data in place and tells the user to remove it manually.","triggerScenarios":"deleteAction encountered an instance whose directory exists but store.Inspect failed to read lima.yaml, so warnAboutMissingInstance reports it. Happens when a `limactl clone`/`start` is concurrently writing the directory, or lima.yaml was deleted/corrupted.","commonSituations":"Interrupted clone/rename leaving a half-written instance dir; concurrent limactl operations on the same store; manual edits/deletions inside ~/.lima/instances/<name>; disk errors truncating lima.yaml.","solutions":["Wait for any concurrent `limactl clone`/`start` to finish, then retry delete","Confirm no limactl process is using the directory (ps aux | grep limactl)","If truly orphaned, remove manually: rm -rf ~/.lima/instances/<name>","Restore lima.yaml from backup if the instance should be kept"],"exampleFix":"// before\n$ limactl delete brokenvm\n// instance \"brokenvm\" directory ... exists but its \"lima.yaml\" could not be read ...\n// after\n$ ps aux | grep limactl        # ensure nothing is cloning into it\n$ rm -rf ~/.lima/instances/brokenvm","handlingStrategy":"validation","validationCode":"const fs = require('fs')\nconst limaYaml = `${instanceDir}/lima.yaml`\nif (fs.existsSync(instanceDir) && !fs.existsSync(limaYaml)) {\n  console.warn('Instance dir unreadable/incomplete; ensure no clone is in progress')\n}","typeGuard":"function isDeletableInstance(dir: string): boolean {\n  return require('fs').existsSync(`${dir}/lima.yaml`)\n}","tryCatchPattern":"try {\n  await deleteInstance(name)\n} catch (err) {\n  if (/could not be read/.test(err.message)) {\n    console.warn('Orphan dir; remove manually after confirming no limactl process:', err.message)\n  } else throw err\n}","preventionTips":["Never run concurrent limactl clone/start/delete on the same instance","Verify clone operations completed before deleting related instances","Do not manually delete files inside ~/.lima/instances/<name>"],"tags":["instance","delete","concurrency","filesystem"],"backgroundTag":"instance-dir-unreadable","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}