{"record":{"id":"180a006b1651160b","repo":"abiosoft/colima","slug":"error-retrieving-instances-w","errorCode":null,"errorMessage":"error retrieving instances: %w","messagePattern":"error retrieving instances: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/vm/lima/limautil/instance.go","lineNumber":90,"sourceCode":"\t}\n\treturn i, nil\n}\n\n// Instances returns Lima instances created by colima.\nfunc Instances(ids ...string) ([]InstanceInfo, error) {\n\tlimaIDs := make([]string, len(ids))\n\tfor i := range ids {\n\t\tlimaIDs[i] = config.ProfileFromName(ids[i]).ID\n\t}\n\targs := append([]string{\"list\", \"--json\"}, limaIDs...)\n\n\tvar buf bytes.Buffer\n\tcmd := Limactl(args...)\n\tcmd.Stderr = nil\n\tcmd.Stdout = &buf\n\n\tif err := cmd.Run(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error retrieving instances: %w\", err)\n\t}\n\n\tvar instances []InstanceInfo\n\tscanner := bufio.NewScanner(&buf)\n\tfor scanner.Scan() {\n\t\tvar i InstanceInfo\n\t\tline := scanner.Bytes()\n\t\tif err := json.Unmarshal(line, &i); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error retrieving instances: %w\", err)\n\t\t}\n\n\t\t// limit to colima instances\n\t\tif !strings.HasPrefix(i.Name, \"colima\") {\n\t\t\tcontinue\n\t\t}\n\n\t\tconf, _ := i.Config()\n\t\tif i.Running() {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/vm/lima/limautil/instance.go#L72-L108","documentation":"Error returned by Instances when the multi-instance 'limactl list --json [ids...]' command exits non-zero. stderr is nil'd out, so the wrapped error carries only the exit status, not limactl's message.","triggerScenarios":"Enumerating instances (e.g. 'colima list') when limactl fails outright: broken binary, unreadable/corrupted Lima config directory, or invalid instance state on disk.","commonSituations":"First 'colima list' after a partial upgrade; ~/.lima owned by another user; leftover lock files from a crashed limactl.","solutions":["Reproduce directly: 'limactl list --json' to surface the hidden stderr","Fix permissions on ~/.lima and ~/.colima","Reinstall/upgrade colima to repair the embedded limactl","Remove stale Lima locks or the offending instance directory"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"If Instances() fails, fall back to a direct 'limactl list --json' subprocess with stderr captured, so the real limactl message replaces the swallowed one; branch on that message (permissions vs corruption vs binary).","preventionTips":["Guard ~/.lima permissions in setup scripts","Upgrade colima and lima together; mixed versions cause hard failures in list"],"tags":["limactl","instances","exec","list"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}