{"record":{"id":"66d8ed31375db91f","repo":"lima-vm/lima","slug":"failed-to-check-if-the-autostart-entry-for-instanc-66d8ed","errorCode":null,"errorMessage":"failed to check if the autostart entry for instance %#q is registered: %w","messagePattern":"failed to check if the autostart entry for instance %#q is registered: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/start-at-login_unix.go","lineNumber":42,"sourceCode":"\t\tinstName = args[0]\n\t}\n\n\tinst, err := store.Inspect(ctx, instName)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\tlogrus.Infof(\"Instance %#q not found\", instName)\n\t\t\treturn nil\n\t\t}\n\t\treturn err\n\t}\n\n\tflags := cmd.Flags()\n\tstartAtLogin, err := flags.GetBool(\"enabled\")\n\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}","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/start-at-login_unix.go#L24-L60","documentation":"startAtLoginAction calls autostart.IsRegistered to check whether the instance's autostart entry (systemd user service / launchd agent) exists; if that check itself fails, the error is wrapped with the instance name and returned. This means the registration lookup could not be performed at all — distinct from the entry simply not being registered.","triggerScenarios":"Running `limactl start-at-login <instance>` (with or without --enabled) on a Unix host where the autostart backend fails: systemctl user session unavailable (no XDG_RUNTIME_DIR / lingering not set up), launchd lookup failure, or underlying command errors.","commonSituations":"Running limactl over SSH without a user systemd session; dbus/session bus not running; systemd user instance not started; non-systemd minimal distros lacking systemctl.","solutions":["Ensure a user systemd session exists: `systemctl --user status` should work in the same environment","Run the command from a normal login session (not a bare SSH exec without session setup)","Enable lingering so user services can run: `loginctl enable-linger $USER`","Check that the platform backend is supported (systemd on Linux, launchd on macOS)"],"exampleFix":"// before: failing over plain ssh without session\nssh host limactl start-at-login default --enabled\n// after\nssh host 'XDG_RUNTIME_DIR=/run/user/$(id -u) systemctl --user status >/dev/null && limactl start-at-login default --enabled'","handlingStrategy":"validation","validationCode":"systemctl --user status >/dev/null 2>&1 || { echo 'no user systemd session; run from a login session or enable lingering' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! limactl start-at-login \"$inst\" 2>err.log; then\n  cat err.log >&2\n  grep -q 'autostart entry' err.log && loginctl enable-linger \"$USER\"\nfi","preventionTips":["Run limactl from a session with a working systemd user instance","Enable lingering for users needing autostart without login","Avoid bare `ssh host limactl ...` without session/dbus setup"],"tags":["autostart","systemd","cli"],"backgroundTag":"systemd-user-session-unavailable","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}