{"record":{"id":"a476d99e9865cd64","repo":"lima-vm/lima","slug":"failed-to-unregister-the-autostart-entry-for-insta","errorCode":null,"errorMessage":"failed to unregister the autostart entry for instance %#q: %w","messagePattern":"failed to unregister the autostart entry for instance %#q: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/start-at-login_unix.go","lineNumber":56,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tif registered, err := autostart.IsRegistered(ctx, inst); err != nil {\n\t\treturn fmt.Errorf(\"failed to check if the autostart entry for instance %#q is registered: %w\", inst.Name, err)\n\t} else if startAtLogin {\n\t\tverb := \"create\"\n\t\tif registered {\n\t\t\tverb = \"update\"\n\t\t}\n\t\tif err := autostart.RegisterToStartAtLogin(ctx, inst); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to %s the autostart entry for instance %#q: %w\", verb, inst.Name, err)\n\t\t}\n\t\tlogrus.Infof(\"The autostart entry for instance %#q has been %sd\", inst.Name, verb)\n\t} else {\n\t\tif !registered {\n\t\t\tlogrus.Infof(\"The autostart entry for instance %#q is not registered\", inst.Name)\n\t\t} else if err := autostart.UnregisterFromStartAtLogin(ctx, inst); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to unregister the autostart entry for instance %#q: %w\", inst.Name, err)\n\t\t} else {\n\t\t\tlogrus.Infof(\"The autostart entry for instance %#q has been unregistered\", inst.Name)\n\t\t}\n\t}\n\n\treturn nil\n}\n","sourceCodeStart":38,"sourceCodeEnd":64,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/start-at-login_unix.go#L38-L64","documentation":"startAtLoginAction wraps failures from autostart.UnregisterFromStartAtLogin with this message when disabling autostart (--enabled not set). The registered check succeeded but actually removing the systemd user unit or launchd agent failed.","triggerScenarios":"Running `limactl start-at-login <instance>` without --enabled while a registered autostart entry exists, and UnregisterFromStartAtLogin fails: unit file deletion denied, `systemctl --user disable/stop` erroring, or launchd unload failing.","commonSituations":"Unit file manually edited/locked or owned by root after sudo misuse; service currently active and refusing stop; dbus/systemd user session degraded; macOS launchd unload errors due to label mismatch.","solutions":["Run `systemctl --user status lima-<instance>` (Linux) to see why disable/stop fails, then stop it manually","Fix ownership/permissions of the autostart unit/plist (avoid managing it with sudo)","Retry after ensuring a healthy user session: `systemctl --user daemon-reload`","As a last resort remove the unit file (~/.config/systemd/user) or plist (~/Library/LaunchAgents) manually and daemon-reload"],"exampleFix":"// before: root-owned unit blocking removal\nsudo limactl start-at-login default   # created root-owned files\n// after\nsudo chown -R $USER ~/.config/systemd/user && limactl start-at-login default","handlingStrategy":"try-catch","validationCode":"systemctl --user is-failed 'lima-*' >/dev/null 2>&1 && systemctl --user reset-failed 'lima-*'","typeGuard":null,"tryCatchPattern":"if ! limactl start-at-login \"$inst\" 2>err.log; then\n  grep -q 'unregister' err.log && {\n    systemctl --user daemon-reload\n    rm -f ~/.config/systemd/user/lima-*.service\n    limactl start-at-login \"$inst\"\n  }\nfi","preventionTips":["Stop/inspect the service before unregistering if it is active or failed","Keep unit files user-owned; avoid sudo-created autostart entries","Run daemon-reload after manual edits to autostart units"],"tags":["autostart","systemd","permissions"],"backgroundTag":"service-unregister-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}