{"record":{"id":"72a1d953226a6388","repo":"lima-vm/lima","slug":"failed-to-check-if-the-autostart-entry-for-instanc","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/edit.go","lineNumber":195,"sourceCode":"\t}\n\n\tstart, err = flags.GetBool(\"start\")\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif tty && !flags.Changed(\"start\") {\n\t\tstart, err = askWhetherToStart(cmd)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\tif !start {\n\t\treturn nil\n\t}\n\t// Network reconciliation will be performed by the process launched by the autostart manager\n\tif registered, err := autostart.IsRegistered(ctx, inst); err != nil && !errors.Is(err, autostart.ErrNotSupported) {\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 !registered {\n\t\terr = reconcile.Reconcile(ctx, inst.Name)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\t// store.Inspect() syncs values between inst.YAML and the store.\n\t// This call applies the validated template to the store.\n\tinst, err = store.Inspect(ctx, inst.Name)\n\tif err != nil {\n\t\treturn err\n\t}\n\treturn instance.Start(ctx, inst, false, false)\n}\n\nfunc askWhetherToStart(cmd *cobra.Command) (bool, error) {\n\tisTTY := uiutil.InputIsTTY(cmd.InOrStdin())","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/edit.go#L177-L213","documentation":"This error wraps a failure that occurred while checking whether the instance has an autostart entry registered with the OS autostart manager (systemd user units on Linux, launchd on macOS). `limactl edit` calls `autostart.IsRegistered` after editing a running instance so it can reconcile state, but only tolerates `autostart.ErrNotSupported` (e.g. WSL2 or an OS without a supported manager). Any other lookup failure (dbus/systemctl/launchctl failure, unexpected exit status) is surfaced through this wrapper with `%#q` quoting of the instance name.","triggerScenarios":"Running `limactl edit <inst>` on an instance that was started with autostart enabled, where the autostart manager query fails: systemd user session unavailable over SSH (no lingering/dbus), `systemctl --user` exits non-zero, or the launchd plist query fails on macOS.","commonSituations":"Editing an autostarted instance on a headless Linux host where the user session is not a real systemd user session; running limactl under an environment where XDG_RUNTIME_DIR is unset so `systemctl --user` cannot connect; partial upgrades where the autostart unit exists but the manager is unreachable; WSL2 edge cases not detected as ErrNotSupported.","solutions":["Verify the host's autostart manager works manually: `systemctl --user status` (Linux) or `launchctl managername` (macOS); fix the session/dbus issue first.","Ensure XDG_RUNTIME_DIR and DBUS_SESSION_BUS_ADDRESS are set when running limactl over SSH; enable `loginctl enable-linger <user>`.","Re-run `limactl start <inst>` (or edit with autostart disabled) so the autostart entry is recreated cleanly.","If the platform genuinely has no autostart manager, confirm lima's driver/platform detection marks it ErrNotSupported (e.g. upgrade lima) instead of failing."],"exampleFix":"// before\n$ limactl edit myvm\nFATA ... failed to check if the autostart entry for instance \"myvm\" is registered: exit status 1\n\n// after\n$ loginctl enable-linger $USER   # make systemd --user session available\n$ limactl edit myvm              # succeeds","handlingStrategy":"try-catch","validationCode":"// Before editing, check the autostart manager is reachable:\nif err := exec.Command(\"systemctl\", \"--user\", \"is-system-running\").Run(); err != nil {\n    log.Println(\"systemd user session unavailable; edit may fail on autostart check\")\n}","typeGuard":null,"tryCatchPattern":"if err := limactlEdit(inst); err != nil {\n    if strings.Contains(err.Error(), \"failed to check if the autostart entry\") {\n        // fall back: disable autostart or fix systemd user session\n        fixSystemdUserSession() // e.g. loginctl enable-linger $USER\n    }\n    return err\n}","preventionTips":["Enable linger for the user on Linux hosts that autostart VMs: `loginctl enable-linger $USER`.","Run limactl inside a session with a working dbus/systemd user session, not a bare cron/SSH shell.","Keep lima updated so unsupported platforms surface ErrNotSupported instead of hard errors."],"tags":["autostart","systemd","cli","limactl-edit"],"backgroundTag":"autostart-manager-unavailable","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}