{"record":{"id":"9b81daead6675cef","repo":"lima-vm/lima","slug":"failed-to-s-the-autostart-entry-for-instance-q","errorCode":null,"errorMessage":"failed to %s the autostart entry for instance %#q: %w","messagePattern":"failed to (.+?) the autostart entry for instance %#q: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/start-at-login_unix.go","lineNumber":49,"sourceCode":"\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}\n\n\treturn nil\n}\n","sourceCodeStart":31,"sourceCodeEnd":64,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/start-at-login_unix.go#L31-L64","documentation":"startAtLoginAction wraps failures from autostart.RegisterToStartAtLogin with this message, using verb \"create\" for a new entry or \"update\" when one already exists. It means limactl could not install or update the autostart unit/agent that starts the instance at login.","triggerScenarios":"Running `limactl start-at-login <instance> --enabled` where RegisterToStartAtLogin fails writing the systemd user unit or launchd plist: permission errors in ~/.config/systemd/user or ~/Library/LaunchAgents, invalid instance paths, or `systemctl --user daemon-reload` failing.","commonSituations":"Read-only or quota-full home directory; SELinux/AppArmor blocking unit install; macOS LaunchAgents dir missing; broken dbus preventing daemon-reload; instance directory moved after creation.","solutions":["Check write permissions on ~/.config/systemd/user (Linux) or ~/Library/LaunchAgents (macOS)","Run `systemctl --user daemon-reload` manually to surface the underlying error","Verify the instance exists and its directory is valid (`limactl list`)","Free disk space / fix home-dir mount if writes are failing"],"exampleFix":"// before: missing directory\nmkdir: no ~/.config/systemd/user\n// after\nmkdir -p ~/.config/systemd/user && limactl start-at-login default --enabled","handlingStrategy":"validation","validationCode":"unit_dir=\"$HOME/.config/systemd/user\"\nmkdir -p \"$unit_dir\" && [ -w \"$unit_dir\" ] || { echo \"cannot write $unit_dir\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"if ! limactl start-at-login \"$inst\" --enabled 2>err.log; then\n  cat err.log >&2; systemctl --user daemon-reload; exit 1\nfi","preventionTips":["Keep ~/.config/systemd/user (or ~/Library/LaunchAgents) user-writable","Never manage user units with sudo","Ensure disk space and a healthy dbus session before registering"],"tags":["autostart","systemd","permissions"],"backgroundTag":"service-registration-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}