{"record":{"id":"6ac04df595095819","repo":"lima-vm/lima","slug":"instance-q-is-stopped-run-limactl-start-s-to-6ac04d","errorCode":null,"errorMessage":"instance %#q is stopped, run `limactl start %s` to start the instance","messagePattern":"instance %#q is stopped, run `limactl start (.+?)` to start the instance","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/tunnel.go","lineNumber":77,"sourceCode":"\t}\n\tport, err := flags.GetInt(\"socks-port\")\n\tif err != nil {\n\t\treturn err\n\t}\n\tif port != 0 && (port < 1024 || port > 65535) {\n\t\treturn fmt.Errorf(\"invalid socks port %d\", port)\n\t}\n\tstdout, stderr := cmd.OutOrStdout(), cmd.ErrOrStderr()\n\tinstName := args[0]\n\tinst, err := store.Inspect(ctx, instName)\n\tif err != nil {\n\t\tif errors.Is(err, os.ErrNotExist) {\n\t\t\treturn fmt.Errorf(\"instance %#q does not exist, run `limactl create %s` to create a new instance\", instName, instName)\n\t\t}\n\t\treturn err\n\t}\n\tif inst.Status == limatype.StatusStopped {\n\t\treturn fmt.Errorf(\"instance %#q is stopped, run `limactl start %s` to start the instance\", instName, instName)\n\t}\n\n\tif port == 0 {\n\t\tport, err = freeport.TCP()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\n\tsshExe, err := sshutil.NewSSHExe()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tsshOpts, err := sshutil.SSHOpts(\n\t\tctx,\n\t\tsshExe,\n\t\tinst.Dir,","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/tunnel.go#L59-L95","documentation":"`limactl tunnel` requires the target instance to be running; if `store.Inspect` reports StatusStopped, the command refuses and suggests `limactl start <inst>`. Tunneling needs the guest's SSH endpoint, which only exists while the VM is up.","triggerScenarios":"Running `limactl tunnel <name>` while the instance's status file records StatusStopped — after `limactl stop`, after a crashed/unsaved VM, or when the status is stale because the VM process died.","commonSituations":"Forgetting to start the VM after rebooting the host; tunnel command left in shell history executed post-stop; stale status after abnormal host shutdown (may need `limactl start` to recover).","solutions":["Run `limactl start <inst>` and retry the tunnel command","Check status with `limactl list` to confirm the instance is Running","If start reports it is already running or stale, try `limactl stop -f <inst>` then start again","Ensure no leftover VM processes; restart the instance to clear stale stopped state"],"exampleFix":"// before\nlimactl tunnel myinst\n// error: instance \"myinst\" is stopped\n// after\nlimactl start myinst\nlimactl tunnel myinst","handlingStrategy":"validation","validationCode":"out, err := exec.Command(\"limactl\", \"list\").Output()\nif err != nil { return err }\nfor _, line := range strings.Split(string(out), \"\\n\") {\n\tf := strings.Fields(line)\n\tif len(f) >= 2 && f[0] == instName {\n\t\tif f[1] != \"Running\" {\n\t\t\treturn fmt.Errorf(\"instance %q is %s; run `limactl start %s`\", instName, f[1], instName)\n\t\t}\n\t}\n}","typeGuard":null,"tryCatchPattern":"if inst.Status == limatype.StatusStopped {\n\treturn fmt.Errorf(\"instance %q is stopped, run `limactl start %s` first\", instName, instName)\n}","preventionTips":["Check `limactl list` status is Running before tunneling","Always start the VM after host reboot before tunnel commands","Handle stale status by stop -f + start if the VM process died unexpectedly"],"tags":["cli","tunnel","instance-state"],"backgroundTag":"instance-not-running","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}