abiosoft/colima · error

error creating lima disk: %w, output: %s

Error message

error creating lima disk: %w, output: %s

What it means

Returned by limautil.CreateDisk when 'limactl disk create <profileID> --size <N>GiB' exits non-zero; the error bundles the captured stdout+stderr of the limactl invocation so the underlying reason is visible in the message.

Source

Thrown at environment/vm/lima/limautil/disk.go:46

	if err := json.NewDecoder(&buf).Decode(&resp); err != nil {
		return false
	}

	return resp.Name == name
}

// CreateDisk creates a lima disk with size in GiB.
func CreateDisk(size int) error {
	name := config.CurrentProfile().ID

	var buf bytes.Buffer
	cmd := Limactl("disk", "create", name, "--size", fmt.Sprintf("%dGiB", size))
	cmd.Stderr = &buf
	cmd.Stdout = &buf

	if err := cmd.Run(); err != nil {
		return fmt.Errorf("error creating lima disk: %w, output: %s", err, buf.String())
	}

	return nil
}

// ResizeDisk resizes disk to new size
func ResizeDisk(size int) error {
	name := config.CurrentProfile().ID

	var buf bytes.Buffer
	cmd := Limactl("disk", "resize", name, "--size", fmt.Sprintf("%dGiB", size))
	cmd.Stderr = &buf
	cmd.Stdout = &buf

	if err := cmd.Run(); err != nil {
		return fmt.Errorf("error resizing disk: %w, output: %s", err, buf.String())
	}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Delete the stale disk and retry: 'limactl disk delete colima' (or 'colima delete' for a full reset)
  2. Check host free space ('df -h') and request a smaller --disk size
  3. Upgrade colima so a current limactl with disk support is embedded
  4. Read the 'output:' portion of the error — it carries limactl's exact complaint

Example fix

# before: 'error creating lima disk ... output: disk already exists'
colima start --disk 50
# after
limactl disk delete colima && colima start --disk 50
Defensive patterns

Strategy: validation

Validate before calling

// avoid 'disk already exists'
if limautil.HasDisk() { // or: limactl disk list | grep -q '^colima'
    _ = limautil.DeleteDisk()
}
err := limautil.CreateDisk(size)

Prevention

When it happens

Trigger: Calling CreateDisk (mounting an additional disk or using the colima-managed data volume) when a lima disk with the same profile name already exists, the host has insufficient free space for the requested size, or the bundled limactl version does not support the 'disk' subcommand.

Common situations: Re-running 'colima start --disk 50' after a failed start left a stale disk behind; requesting a disk larger than free host space; ancient colima/lima versions predating limactl disk support.

Related errors


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