abiosoft/colima · error

error during Lima prune: %w

Error message

error during Lima prune: %w

What it means

With `--all`, `colima prune` additionally runs `limactl prune` to clear Lima's own cache/assets after the colima cache was already emptied. This error wraps that subprocess failing — the colima cache is gone at this point, only the Lima cleanup failed. Typical causes: limactl version mismatch with colima, permission issues in Lima's cache (~/Library/Caches/lima or ~/.cache/lima), or corrupted Lima state.

Source

Thrown at cmd/prune.go:48

		limaCacheDir := filepath.Join(filepath.Dir(colimaCacheDir), "lima")
		if !pruneCmdArgs.force {
			msg := "'" + colimaCacheDir + "' will be emptied, are you sure"
			if pruneCmdArgs.all {
				msg = "'" + colimaCacheDir + "' and '" + limaCacheDir + "' will be emptied, are you sure"
			}
			if y := cli.Prompt(msg); !y {
				return nil
			}
		}
		logrus.Info("Pruning ", strconv.Quote(config.CacheDir()))
		if err := os.RemoveAll(config.CacheDir()); err != nil {
			return fmt.Errorf("error during prune: %w", err)
		}

		if pruneCmdArgs.all {
			cmd := limautil.Limactl("prune")
			if err := cmd.Run(); err != nil {
				return fmt.Errorf("error during Lima prune: %w", err)
			}
		}

		return nil
	},
}

func init() {
	root.Cmd().AddCommand(pruneCmd)

	pruneCmd.Flags().BoolVarP(&pruneCmdArgs.force, "force", "f", false, "do not prompt for yes/no")
	pruneCmd.Flags().BoolVarP(&pruneCmdArgs.all, "all", "a", false, "include Lima assets")
}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Update the pairing: `brew upgrade colima lima` (or reinstall the release), then retry `colima prune --all --force`
  2. Clear Lima's cache manually: `sudo rm -rf ~/Library/Caches/lima` (macOS) or `~/.cache/lima` (Linux) — colima's own cache was already pruned successfully
  3. If you only meant to clear colima's cache, drop --all; the Lima step is optional

Example fix

# before
$ colima prune --all --force
error: error during Lima prune: exit status 1

# after
$ brew upgrade colima lima
$ colima prune --all --force
Defensive patterns

Strategy: try-catch

Validate before calling

// optional precondition: only the lima step can fail (--all); check pairing first
if _, err := exec.LookPath("limactl"); err != nil {
    // colima bundles its own limactl; a missing/mismatched one signals version skew -> upgrade first
}

Try / catch

if err := pruneCmd.Execute(); err != nil {
    if strings.Contains(err.Error(), "error during Lima prune") {
        // colima cache already cleared; safe fallback: manually rm -rf the lima cache dir
        // ~/Library/Caches/lima (darwin) or ~/.cache/lima (linux)
    }
}

Prevention

When it happens

Trigger: `colima prune --all` where the bundled limactl errors: an outdated colima/lima pairing after a partial upgrade; root-owned files in the Lima cache from sudo usage; limactl prune failing on a missing or corrupt lima home.

Common situations: Upgrading colima via brew but leaving stale lima assets on disk; mixing colima versions (brew + manual binary) sharing the same lima caches; pruning --all immediately after a failed VM creation.

Related errors


AI-assisted analysis of abiosoft/colima@c3a5f9184d (2026-08-15). Data as JSON: /api/errors/e7bc8a009cba45ee. Report an issue: GitHub.