{"record":{"id":"dc2198ec5e6ff451","repo":"lima-vm/lima","slug":"instance-q-not-found-dc2198","errorCode":null,"errorMessage":"instance %#q not found","messagePattern":"instance %#q not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/clone.go","lineNumber":71,"sourceCode":"\trenameCommand.Flags().Bool(\"start\", false, \"Start the instance after renaming\")\n\teditflags.RegisterEdit(renameCommand, \"[limactl edit] \")\n\treturn renameCommand\n}\n\nfunc cloneOrRenameAction(cmd *cobra.Command, args []string) error {\n\trename := cmd.Name() == \"rename\"\n\tctx := cmd.Context()\n\tflags := cmd.Flags()\n\ttty, err := flags.GetBool(\"tty\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\toldInstName, newInstName := args[0], args[1]\n\toldInst, err := store.Inspect(ctx, oldInstName)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\treturn fmt.Errorf(\"instance %#q not found\", oldInstName)\n\t\t}\n\t\treturn err\n\t}\n\n\tnewInst, err := instance.CloneOrRename(ctx, oldInst, newInstName, rename)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tyqExprs, err := editflags.YQExpressions(flags, false, newInst.Config.Param)\n\tif err != nil {\n\t\treturn err\n\t}\n\tvar start bool\n\tif len(yqExprs) > 0 {\n\t\t// TODO: reduce duplicated codes across cloneAction and editAction\n\t\tyq := yqutil.Join(yqExprs)\n\t\tfilePath := filepath.Join(newInst.Dir, filenames.LimaYAML)","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/clone.go#L53-L89","documentation":"The instance name given as the source of a clone/rename does not exist in the Lima store. store.Inspect returned os.ErrNotExist, so cloneOrRenameAction converts it into this clearer message instead of leaking the raw store error. No instance directory with a readable lima.yaml exists under ${LIMA_HOME}/instances for that name.","triggerScenarios":"`limactl clone <old> <new>` or `limactl rename <old> <new>` where <old> was never created, was already renamed/deleted, or is misspelled. Also triggered when the instance dir exists but lima.yaml is unreadable (that yields the other warning path in delete, but here Inspect returns ErrNotExist).","commonSituations":"Typo in instance name; running clone from a different LIMA_HOME; instance previously renamed; stale scripts referencing deleted instances.","solutions":["Run `limactl list` to see existing instance names and correct the spelling","Verify LIMA_HOME points to the same store the instance was created in (default ~/.lima)","Create the instance first with `limactl start` if it does not exist yet","If the instance was deleted, restore it from backup or recreate it before cloning"],"exampleFix":"// before\n$ limactl clone myvm1 myvm2\n// instance \"myvm1\" not found\n// after\n$ limactl list\n$ limactl clone myvm myvm2","handlingStrategy":"validation","validationCode":"const instances = await listInstances()\nif (!instances.some(i => i.name === oldName)) {\n  throw new Error(`instance ${oldName} not found; run limactl list`)\n}","typeGuard":"function instanceExists(name: string, instances: {name: string}[]): boolean {\n  return instances.some(i => i.name === name)\n}","tryCatchPattern":"try {\n  await cloneOrRename(oldName, newName)\n} catch (err) {\n  if (/not found/.test(err.message)) {\n    console.error(`Instance ${oldName} does not exist in this LIMA_HOME`)\n  } else throw err\n}","preventionTips":["Run `limactl list` before clone/rename to confirm names","Verify LIMA_HOME matches the store used at creation","Avoid renaming instances in scripts without a pre-check"],"tags":["instance","limactl","not-found"],"backgroundTag":"instance-not-found","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}