{"record":{"id":"068e6fc8b5863d71","repo":"abiosoft/colima","slug":"error-retrieving-instance-w","errorCode":null,"errorMessage":"error retrieving instance: %w","messagePattern":"error retrieving instance: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/limautil/instance.go","lineNumber":57,"sourceCode":"// Config returns the current Colima config\nfunc (i InstanceInfo) Config() (config.Config, error) {\n\treturn configmanager.LoadFrom(config.ProfileFromName(i.Name).StateFile())\n}\n\n// Lima statuses\nconst (\n\tlimaStatusRunning = \"Running\"\n)\n\nfunc getInstance(profileID string) (InstanceInfo, error) {\n\tvar i InstanceInfo\n\tvar buf bytes.Buffer\n\tcmd := Limactl(\"list\", profileID, \"--json\")\n\tcmd.Stderr = nil\n\tcmd.Stdout = &buf\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn i, fmt.Errorf(\"error retrieving instance: %w\", err)\n\t}\n\n\tif buf.Len() == 0 {\n\t\treturn i, fmt.Errorf(\"instance '%s' does not exist\", config.ProfileFromName(profileID).DisplayName)\n\t}\n\n\tif err := json.Unmarshal(buf.Bytes(), &i); err != nil {\n\t\treturn i, fmt.Errorf(\"error retrieving instance: %w\", err)\n\t}\n\n\tif conf, err := i.Config(); err == nil {\n\t\tif conf.Disk > 0 {\n\t\t\ti.Disk = config.Disk(conf.Disk).Int()\n\t\t}\n\t}\n\treturn i, nil\n}\n","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/limautil/instance.go#L39-L75","documentation":"Error returned by getInstance when 'limactl list <profileID> --json' itself exits non-zero while fetching a single instance's info. Note cmd.Stderr is set to nil, so limactl's explanation is discarded and only the exit error is wrapped.","triggerScenarios":"Running limactl list for a profile when the limactl binary is broken/missing, the Lima configuration directory is corrupted, or limactl encounters an internal error (all produce non-zero exit before any JSON output).","commonSituations":"Half-updated colima whose embedded limactl mismatches the on-disk ~/.lima state; ~/.colima or ~/.lima files made root-owned; limactl crashing on a malformed instance database.","solutions":["Run 'limactl list' directly to see the real failure message that this error hides","Reinstall/upgrade colima so limactl and the Lima state layout match","Fix ownership: sudo chown -R $(whoami) ~/.lima ~/.colima","If one instance's files are corrupted, 'colima delete <profile>' removes just that instance"],"exampleFix":"# before: only 'error retrieving instance' is shown\n# after: reproduce with stderr visible to get the cause\nlimactl list colima --json; echo \"exit=$?\"","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"On error from Instance(), shell out once to 'limactl list <id> --json' with stderr inherited to recover the hidden failure text, then decide: broken limactl -> reinstall; corrupt instance -> colima delete.","preventionTips":["Keep colima and its embedded limactl version-aligned (avoid mixing a foreign limactl on PATH)","Don't sudo colima/limactl — root-owned state under ~/.lima is the top cause"],"tags":["limactl","instance","exec","diagnostics"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}