abiosoft/colima · error

instance '%s' does not exist

Error message

instance '%s' does not exist

What it means

Error returned by getInstance when 'limactl list <profileID> --json' succeeds but prints nothing (buf.Len() == 0), which Lima signals for a non-existent instance. The message renders the human-facing profile display name.

Source

Thrown at environment/vm/lima/limautil/instance.go:61

// Lima statuses
const (
	limaStatusRunning = "Running"
)

func getInstance(profileID string) (InstanceInfo, error) {
	var i InstanceInfo
	var buf bytes.Buffer
	cmd := Limactl("list", profileID, "--json")
	cmd.Stderr = nil
	cmd.Stdout = &buf

	if err := cmd.Run(); err != nil {
		return i, fmt.Errorf("error retrieving instance: %w", err)
	}

	if buf.Len() == 0 {
		return i, fmt.Errorf("instance '%s' does not exist", config.ProfileFromName(profileID).DisplayName)
	}

	if err := json.Unmarshal(buf.Bytes(), &i); err != nil {
		return i, fmt.Errorf("error retrieving instance: %w", err)
	}

	if conf, err := i.Config(); err == nil {
		if conf.Disk > 0 {
			i.Disk = config.Disk(conf.Disk).Int()
		}
	}
	return i, nil
}

// Instances returns Lima instances created by colima.
func Instances(ids ...string) ([]InstanceInfo, error) {
	limaIDs := make([]string, len(ids))
	for i := range ids {

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Create the VM first: 'colima start -p <profile>'
  2. Check what exists: 'colima list' and 'limactl list'
  3. Fix the profile name / COLIMA_DEFAULT_PROFILE environment variable
  4. If metadata and Lima disagree, 'colima delete -p <profile>' then start fresh

Example fix

# before: 'instance colima does not exist'
colima ssh -p work
# after
colima start -p work && colima ssh -p work
Defensive patterns

Strategy: validation

Validate before calling

// existence check before touching an instance
func instanceExists(profileID string) bool {
    _, err := limautil.Instance() // or limactl list <id> --json | grep .
    return err == nil && !strings.Contains(err.Error(), "does not exist")
}

Try / catch

In Go: if _, err := limautil.GetInstance(...); err != nil { if strings.Contains(err.Error(), "does not exist") { /* create then retry */ } else { return err } }.

Prevention

When it happens

Trigger: Querying a profile that was never created, was removed via 'colima delete', or whose Lima instance directory under ~/.lima was manually deleted.

Common situations: Running docker/ssh commands after 'colima delete'; wrong COLIMA_DEFAULT_PROFILE or a typo'd 'colima start -p name' where the profile exists in colima metadata but not in Lima; fresh machine where start never completed.

Related errors


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