lima-vm/lima · error

failed to check if the autostart entry for instance %#q is r

Error message

failed to check if the autostart entry for instance %#q is registered: %w

What it means

Before starting a stopped instance, startAction consults the platform autostart manager (launchd/systemd) via autostart.IsRegistered. If that check fails with an error other than ErrNotSupported, the start is aborted with this wrapped error, since Lima cannot determine whether it should reconcile the autostart entry.

Source

Thrown at cmd/limactl/start.go:613

	}
	if len(inst.Errors) > 0 {
		return fmt.Errorf("errors inspecting instance: %+v", inst.Errors)
	}
	switch inst.Status {
	case limatype.StatusRunning:
		logrus.Infof("The instance %#q is already running. Run `%s` to open the shell.",
			inst.Name, instance.LimactlShellCmd(inst.Name))
		// Not an error
		return nil
	case limatype.StatusStopped:
		// NOP
	default:
		logrus.Warnf("expected status %#q, got %#q", limatype.StatusStopped, inst.Status)
	}
	ctx := cmd.Context()
	// Network reconciliation will be performed by the process launched by the autostart manager
	if registered, err := autostart.IsRegistered(ctx, inst); err != nil && !errors.Is(err, autostart.ErrNotSupported) {
		return fmt.Errorf("failed to check if the autostart entry for instance %#q is registered: %w", inst.Name, err)
	} else if (registered && autostart.AutoStartedIdentifier() != "") || !registered {
		err = reconcile.Reconcile(ctx, inst.Name)
		if err != nil {
			return err
		}
	}

	launchHostAgentForeground := false
	if runtime.GOOS != "windows" {
		foreground, err := cmd.Flags().GetBool("foreground")
		if err != nil {
			return err
		}
		launchHostAgentForeground = foreground
	}
	timeout, err := cmd.Flags().GetDuration("timeout")
	if err != nil {
		return err

View on GitHub (pinned to dd909d0973)

Solutions

  1. Verify the autostart backend works: run `systemctl --user status` (Linux) or `launchctl print gui/$(id -u)` (macOS)
  2. Check that systemctl/launchctl binaries are on PATH
  3. If autostart is irrelevant, ensure the failure isn't ErrNotSupported (which is tolerated); otherwise fix the manager or file an issue
  4. Start the instance after repairing the init system user session
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check the autostart backend
systemctl --user is-system-running 2>/dev/null || [[ $(uname) == Darwin ]] || echo 'systemd user session unavailable; autostart checks may fail'

Try / catch

if ! limactl start <name>; then
  echo 'autostart check failed; repair launchctl/systemctl user session and retry'
fi

Prevention

When it happens

Trigger: `limactl start <name>` on a stopped instance when the autostart manager query fails — e.g. `launchctl print`/`systemctl is-enabled` unavailable or erroring, corrupted user service directories, or permission problems invoking the manager.

Common situations: Broken or minimal systemd user session in Linux containers/WSL; launchctl failing on macOS due to a stale or damaged user domain; PATH issues hiding systemctl/launchctl.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/a1f73ac8371bf47e. Report an issue: GitHub.