{"record":{"id":"0cc17d3da8b4e9f1","repo":"abiosoft/colima","slug":"cannot-list-storage-pool-disks-w","errorCode":null,"errorMessage":"cannot list storage pool disks: %w","messagePattern":"cannot list storage pool disks: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"environment/container/incus/incus.go","lineNumber":443,"sourceCode":"\t\t\"incus-ui-canonical\",\n\t}\n\n\treturn debutil.UpdateRuntime(ctx, c.guest, c, packages...)\n}\n\nfunc (c *incusRuntime) poolImported() bool {\n\tscript := strings.NewReplacer(\n\t\t\"{pool_name}\", poolName,\n\t).Replace(\"sudo zpool list -H -o name | grep '^{pool_name}$'\")\n\treturn c.guest.RunQuiet(\"sh\", \"-c\", script) == nil\n}\n\nfunc (c *incusRuntime) recoverDisk(ctx context.Context) error {\n\tvar disks []string\n\tstr, err := c.guest.RunOutput(\"sh\", \"-c\", \"sudo ls \"+poolDisksDir+\" | grep '.img$'\")\n\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot list storage pool disks: %w\", err)\n\t}\n\n\tdisks = strings.Fields(str)\n\tif len(disks) == 0 {\n\t\treturn fmt.Errorf(\"no existing storage pool disks found\")\n\t}\n\n\tlog := c.Logger(ctx)\n\n\tlog.Println()\n\tlog.Println(\"Running 'incus admin recover' ...\")\n\tlog.Println()\n\tlog.Println(fmt.Sprintf(\"Found %d storage pool source(s):\", len(disks)))\n\tfor _, disk := range disks {\n\t\tlog.Println(\"  \" + poolDisksDir + \"/\" + disk)\n\t}\n\tlog.Println()\n","sourceCodeStart":425,"sourceCodeEnd":461,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/environment/container/incus/incus.go#L425-L461","documentation":"During storage recovery, colima runs 'sudo ls <poolDisksDir> | grep \".img$\" in the guest and the pipeline exited non-zero. Note the grep: it exits 1 when NOTHING matches, so this error fires both when listing genuinely fails and when the directory simply contains no .img disk files.","triggerScenarios":"RunOutput('sh','-c','sudo ls ... | grep \".img$\"') errors: poolDisksDir missing/empty, no *.img files (grep exit 1), sudo failure, or guest SSH broken.","commonSituations":"Data disk mounted but pool disks were deleted manually, first start after a wipe where the directory was removed, path drift after a colima version changed the disk layout, /var/lib/incus not mounted.","solutions":["Check the directory in the guest: 'colima ssh -- sudo ls -la /var/lib/incus/disks'","If files exist but have different names, verify which colima version created them (layout migration may be needed)","If genuinely empty, answer 'no' at the recovery prompt so colima wipes and recreates the pool","Ensure /var/lib/incus (data disk) is mounted before starting colima"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// distinguish 'no matches' (grep exit 1) from real listing failures\nstr, err := c.guest.RunOutput(\"sh\", \"-c\", \"sudo ls \"+poolDisksDir+\" 2>/dev/null | grep '.img$' || true\")\nif err != nil {\n    return fmt.Errorf(\"cannot list storage pool disks: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"str, err := c.guest.RunOutput(\"sh\", \"-c\", \"sudo ls \"+poolDisksDir+\" | grep '.img$'\")\nif err != nil {\n    if strings.Contains(err.Error(), \"exit status 1\") {\n        // grep found nothing — treat as 'no disks', not a hard error\n        return fmt.Errorf(\"no existing storage pool disks found\")\n    }\n    return fmt.Errorf(\"cannot list storage pool disks: %w\", err)\n}","preventionTips":["Remember grep exits 1 on zero matches when scripting pipelines","Verify /var/lib/incus is mounted before recovery attempts","Keep disk files where colima put them"],"tags":["incus","storage","recovery","shell","grep"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}