{"record":{"id":"a1f73ac8371bf47e","repo":"lima-vm/lima","slug":"failed-to-check-if-the-autostart-entry-for-instanc-a1f73a","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.go","lineNumber":613,"sourceCode":"\t}\n\tif len(inst.Errors) > 0 {\n\t\treturn fmt.Errorf(\"errors inspecting instance: %+v\", inst.Errors)\n\t}\n\tswitch inst.Status {\n\tcase limatype.StatusRunning:\n\t\tlogrus.Infof(\"The instance %#q is already running. Run `%s` to open the shell.\",\n\t\t\tinst.Name, instance.LimactlShellCmd(inst.Name))\n\t\t// Not an error\n\t\treturn nil\n\tcase limatype.StatusStopped:\n\t\t// NOP\n\tdefault:\n\t\tlogrus.Warnf(\"expected status %#q, got %#q\", limatype.StatusStopped, inst.Status)\n\t}\n\tctx := cmd.Context()\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 && autostart.AutoStartedIdentifier() != \"\") || !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\tlaunchHostAgentForeground := false\n\tif runtime.GOOS != \"windows\" {\n\t\tforeground, err := cmd.Flags().GetBool(\"foreground\")\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tlaunchHostAgentForeground = foreground\n\t}\n\ttimeout, err := cmd.Flags().GetDuration(\"timeout\")\n\tif err != nil {\n\t\treturn err","sourceCodeStart":595,"sourceCodeEnd":631,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/start.go#L595-L631","documentation":"Before starting a stopped instance, startAction consults the platform autostart manager (launchd/systemd) via autostart.IsRegistered. If that check fails with an error other than ErrNotSupported, the start is aborted with this wrapped error, since Lima cannot determine whether it should reconcile the autostart entry.","triggerScenarios":"`limactl start <name>` on a stopped instance when the autostart manager query fails — e.g. `launchctl print`/`systemctl is-enabled` unavailable or erroring, corrupted user service directories, or permission problems invoking the manager.","commonSituations":"Broken or minimal systemd user session in Linux containers/WSL; launchctl failing on macOS due to a stale or damaged user domain; PATH issues hiding systemctl/launchctl.","solutions":["Verify the autostart backend works: run `systemctl --user status` (Linux) or `launchctl print gui/$(id -u)` (macOS)","Check that systemctl/launchctl binaries are on PATH","If autostart is irrelevant, ensure the failure isn't ErrNotSupported (which is tolerated); otherwise fix the manager or file an issue","Start the instance after repairing the init system user session"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-check the autostart backend\nsystemctl --user is-system-running 2>/dev/null || [[ $(uname) == Darwin ]] || echo 'systemd user session unavailable; autostart checks may fail'","typeGuard":null,"tryCatchPattern":"if ! limactl start <name>; then\n  echo 'autostart check failed; repair launchctl/systemctl user session and retry'\nfi","preventionTips":["Ensure a working systemd user session on Linux / healthy launchctl on macOS","Keep systemctl/launchctl on PATH","Update Lima if ErrNotSupported handling is missing for your platform"],"tags":["cli","autostart","systemd","launchd"],"backgroundTag":"autostart-manager-check-failed","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}