abiosoft/colima · error

not running

Error message

not running

What it means

limaVM.Env returns the value of an environment variable from inside the guest by first checking l.Running(ctx) (a state query against the Lima instance) and then echoing the variable over SSH. If the VM is not in a running state, the call short-circuits with the bare error 'not running' before touching the guest. This is a state precondition failure, not an execution failure.

Source

Thrown at environment/vm/lima/lima.go:279

	// minor delay to prevent possible race condition.
	time.Sleep(time.Second * 2)

	if err := l.Start(ctx, l.conf); err != nil {
		return err
	}

	return nil
}

func (l limaVM) Host() environment.HostActions {
	return l.host
}

func (l limaVM) Env(s string) (string, error) {
	ctx := context.Background()
	if !l.Running(ctx) {
		return "", fmt.Errorf("not running")
	}
	return l.RunOutput("echo", "$"+s)
}

func (l limaVM) Created() bool {
	stat, err := os.Stat(config.CurrentProfile().LimaFile())
	return err == nil && !stat.IsDir()
}

func (l limaVM) User() (string, error) {
	return l.RunOutput("whoami")
}

func (l limaVM) Arch() environment.Arch {
	a, _ := l.RunOutput("uname", "-m")
	return environment.Arch(a)
}

View on GitHub (pinned to c3a5f9184d)

Solutions

  1. Guard the call with `if !vm.Running(ctx) { start or wait }` before requesting Env.
  2. Retry with backoff for a few seconds after Start to let Lima's state settle.
  3. Check `colima status` in scripts before querying guest environment details.
  4. Handle the 'not running' error string explicitly in callers to distinguish it from SSH failures.

Example fix

// before
val, err := vm.Env("DOCKER_HOST") // may error 'not running'

// after
if !vm.Running(ctx) {
    return fmt.Errorf("vm not running; start before reading env")
}
val, err := vm.Env("DOCKER_HOST")
Defensive patterns

Strategy: validation

Validate before calling

if !vm.Running(ctx) {
    return fmt.Errorf("cannot read guest env: VM not running")
}
val, err := vm.Env("DOCKER_HOST")

Try / catch

Go: on err != nil, if err.Error() == "not running" handle by starting/waiting instead of reporting an execution failure.

Prevention

When it happens

Trigger: Calling Env while the VM is stopped, starting, or stopping; calling immediately after Start returns but before Lima reports the running state; a crashed VM whose state query reports non-running. Note Running uses a background context internally so it cannot be cancelled by the caller.

Common situations: Automation that queries guest env vars right after start commands (boot race); scripts running against a profile the user stopped; daemon code polling guest env on a deleted instance.

Related errors


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