{"record":{"id":"f946ef2334c112d7","repo":"lima-vm/lima","slug":"failed-to-inspect-instance-q-w-f946ef","errorCode":null,"errorMessage":"failed to inspect instance %#q: %w","messagePattern":"failed to inspect instance %#q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/unprotect.go","lineNumber":34,"sourceCode":"func newUnprotectCommand() *cobra.Command {\n\tunprotectCommand := &cobra.Command{\n\t\tUse:               \"unprotect INSTANCE [INSTANCE, ...]\",\n\t\tShort:             \"Unprotect an instance\",\n\t\tArgs:              WrapArgsError(cobra.MinimumNArgs(1)),\n\t\tRunE:              unprotectAction,\n\t\tValidArgsFunction: unprotectBashComplete,\n\t\tGroupID:           advancedCommand,\n\t}\n\treturn unprotectCommand\n}\n\nfunc unprotectAction(cmd *cobra.Command, args []string) error {\n\tctx := cmd.Context()\n\tvar errs []error\n\tfor _, instName := range args {\n\t\tinst, err := store.Inspect(ctx, instName)\n\t\tif err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to inspect instance %#q: %w\", instName, err))\n\t\t\tcontinue\n\t\t}\n\t\tif !inst.Protected {\n\t\t\tlogrus.Warnf(\"Instance %#q isn't protected. Skipping.\", instName)\n\t\t\tcontinue\n\t\t}\n\t\tif err := inst.Unprotect(); err != nil {\n\t\t\terrs = append(errs, fmt.Errorf(\"failed to unprotect instance %#q: %w\", instName, err))\n\t\t\tcontinue\n\t\t}\n\t\tlogrus.Infof(\"Unprotected %#q\", instName)\n\t}\n\treturn errors.Join(errs...)\n}\n\nfunc unprotectBashComplete(cmd *cobra.Command, _ []string, _ string) ([]string, cobra.ShellCompDirective) {\n\treturn bashCompleteInstanceNames(cmd)\n}","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/unprotect.go#L16-L52","documentation":"Thrown by `limactl unprotect` when `store.Inspect` cannot load the named instance from the Lima instance store (`~/.lima/<instance>`). It wraps the underlying error (missing instance directory, corrupt instance.yml, etc.) with the instance name using Go's %#q quoting. The command aggregates these per-instance errors via errors.Join, so other instances in the same invocation are still processed.","triggerScenarios":"Running `limactl unprotect NAME` where NAME does not exist in LIMA_HOME, the instance directory lacks a loadable instance.yml, or store.Inspect fails for another reason (e.g. permission problems on ~/.lima).","commonSituations":"Typo in the instance name; running as a different user whose LIMA_HOME does not contain the instance; instance was deleted while the CLI invocation was in flight; corrupted or partially written instance metadata after an interrupted operation.","solutions":["Run `limactl list` to verify the exact instance name and correct the typo.","Check LIMA_HOME points to the directory that actually holds the instance (default ~/.lima).","Verify the instance directory exists and instance.yml is readable by the current user.","Recreate the instance if its metadata is corrupt."],"exampleFix":"// before\nlimactl unprotect my-inst\n// failed to inspect instance \"my-inst\": ...\n// after\nlimactl list           # find correct name, e.g. my-inst-0\nlimactl unprotect my-inst-0","handlingStrategy":"validation","validationCode":"instNames, err := store.InstanceNames(ctx) // or limactl list\nfor _, want := range args {\n    if !slices.Contains(instNames, want) {\n        return fmt.Errorf(\"instance %q does not exist\", want)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := unprotectCmd.RunE(cmd, args); err != nil {\n    // errors.Join result: inspect each joined error with errors.Is/As\n    for _, e := range errors.Unwrap Multi(err) { ... }\n}","preventionTips":["Tab-complete instance names (`limactl unprotect <TAB>`).","Check `limactl list` before batch unprotect operations.","Ensure LIMA_HOME is set consistently across scripts and shells."],"tags":["cli","instance-store","limactl"],"backgroundTag":"instance-not-found","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}