lima-vm/lima · error

failed to register instance %#q to start at login: %w

Error message

failed to register instance %#q to start at login: %w

What it means

autostartEnableAction delegates to the platform autostart manager via autostart.ManagerWith(keepAlive).RegisterToStartAtLogin(ctx, inst); this error wraps any failure from that registration (on non-Darwin: writing the desktop autostart entry or startup shortcut; propagated from the underlying manager).

Source

Thrown at cmd/limactl/autostart_others.go:44

		return errors.New("--condition=boot is only supported on macOS")
	}

	ctx := cmd.Context()
	inst, err := store.Inspect(ctx, args[0])
	if err != nil {
		if errors.Is(err, os.ErrNotExist) {
			return fmt.Errorf("instance %q not found", args[0])
		}
		return err
	}

	keepAlive, err := cmd.Flags().GetBool("keep-alive")
	if err != nil {
		return err
	}
	mgr := autostart.ManagerWith(keepAlive)
	if err := mgr.RegisterToStartAtLogin(ctx, inst); err != nil {
		return fmt.Errorf("failed to register instance %#q to start at login: %w", inst.Name, err)
	}
	logrus.Infof("Instance %#q registered to start at login", inst.Name)
	return nil
}

func autostartDisableAction(cmd *cobra.Command, args []string) error {
	ctx := cmd.Context()
	inst, err := store.Inspect(ctx, args[0])
	if err != nil {
		if errors.Is(err, os.ErrNotExist) {
			return fmt.Errorf("instance %q not found", args[0])
		}
		return err
	}

	if registered, err := autostart.IsRegistered(ctx, inst); err != nil {
		return err
	} else if !registered {

View on GitHub (pinned to dd909d0973)

Solutions

  1. Check the wrapped error text for the underlying cause
  2. Verify the autostart directory exists and is writable: `mkdir -p ~/.config/autostart && touch ~/.config/autostart/test`
  3. Check disk space in the home filesystem (`df -h ~`)
  4. On Windows, confirm the user's Startup folder is writable and not policy-locked

Example fix

// before: limactl autostart myinstance  (fails: ~/.config/autostart unwritable)
// after:  mkdir -p ~/.config/autostart && chmod u+w ~/.config/autostart && limactl autostart myinstance
Defensive patterns

Strategy: try-catch

Validate before calling

mkdir -p ~/.config/autostart 2>/dev/null && touch ~/.config/autostart/.wtest && rm ~/.config/autostart/.wtest || {
  echo "autostart directory not writable"; exit 1
}
df -h ~ | awk 'NR==2 && $5+0 >= 95 {print "home volume nearly full"; exit 1}'

Try / catch

cmd := exec.Command("limactl", "autostart", inst)
out, err := cmd.CombinedOutput()
if err != nil {
	if strings.Contains(string(out), "failed to register instance") {
		log.Fatalf("autostart registration failed (check autostart dir perms / disk space): %v: %s", err, out)
	}
	log.Fatal(err)
}

Prevention

When it happens

Trigger: `limactl autostart <instance>` on Linux/Windows when RegisterToStartAtLogin fails: unwritable autostart location (~/.config/autostart on Linux, Startup folder on Windows), home directory missing, disk full, or the manager backend returning an OS-level error.

Common situations: Read-only or quota'd home directory; XDG_CONFIG_HOME pointing somewhere unwritable; enterprise policies blocking Startup-folder entries on Windows; disk full.

Related errors


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