lima-vm/lima · error

failed to unregister instance %#q from start at login

Error message

failed to unregister instance %#q from start at login: %w

What it means

limactl unregister (autostart disable) failed to remove the instance's entry from the login-time autostart mechanism. The instance was previously registered with `limactl start --autostart`, and the platform-specific autostart helper (launchd/systemd/Task Scheduler wrapper) returned an error while removing its entry. The original error is wrapped so the root cause (permissions, missing service file) is preserved.

Solutions

  1. Fix the underlying wrapped error (usually a filesystem permission or missing file issue in the autostart config dir)
  2. Check permissions on ~/.config/systemd/user (Linux), ~/Library/LaunchAgents (macOS), or the Windows Startup folder and re-run as the same user that registered the entry
  3. If the entry is already gone, verify with `limactl list` / inspect the autostart dir; re-register then unregister again to reset state
  4. As a last resort, manually delete the instance's autostart file and re-run the command

Example fix

// before
$ limactl unregister myvm
// failed to unregister instance "myvm" from start at login: ...
// after
$ ls ~/Library/LaunchAgents   # or ~/.config/systemd/user
$ chmod u+w <autostart-dir>   # fix permissions
$ limactl unregister myvm
Defensive patterns

Strategy: try-catch

Validate before calling

const registered = await isAutostartRegistered(inst)
if (!registered) return null // nothing to unregister

Type guard

function isPermissionErr(err: unknown): boolean {
  return err instanceof Error && /permission denied|EACCES|ENOENT/.test(err.message)
}

Try / catch

try {
  await unregisterFromStartAtLogin(inst)
} catch (err) {
  if (isPermissionErr(err)) {
    console.error('Check perms on the autostart dir; fix and retry:', err)
  } else {
    throw err
  }
}

Prevention

When it happens

Trigger: Running `limactl unregister <instance>` (or equivalent autostartDisableAction) when the instance has an autostart entry (registered=true) and autostart.UnregisterFromStartAtLogin fails, e.g. the platform autostart file/directory is unwritable or was deleted externally.

Common situations: Removing a launchd/systemd user file manually then trying to unregister; running limactl under a user without permission to the autostart directory; partially deleted ${LIMA_HOME}/_config/autostart entries.

Related errors


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

Appendix: source

Thrown at cmd/limactl/autostart_others.go:68

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 {
		logrus.Infof("Instance %#q is not registered for automatic startup", inst.Name)
		return nil
	}

	if err := autostart.UnregisterFromStartAtLogin(ctx, inst); err != nil {
		return fmt.Errorf("failed to unregister instance %#q from start at login: %w", inst.Name, err)
	}
	logrus.Infof("Instance %#q unregistered from start at login", inst.Name)
	return nil
}

View on GitHub (pinned to dd909d0973)