{"record":{"id":"5a9ef4ce0b00f5df","repo":"lima-vm/lima","slug":"instance-q-is-not-running-status-s","errorCode":null,"errorMessage":"instance %q is not running (status: %s)","messagePattern":"instance %q is not running \\(status: (.+?)\\)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/limactl/screenshot.go","lineNumber":42,"sourceCode":"\t\tShort:   \"Capture a screenshot of the VM display\",\n\t\tArgs:    WrapArgsError(cobra.ExactArgs(1)),\n\t\tRunE:    screenshotAction,\n\t\tGroupID: advancedCommand,\n\t}\n\tcmd.Flags().StringP(\"output\", \"o\", \"\", \"Output path; extension must be .png or .bmp (default: INSTANCE-screenshot.png)\")\n\treturn cmd\n}\n\nfunc screenshotAction(cmd *cobra.Command, args []string) error {\n\tinstName := args[0]\n\n\tctx := cmd.Context()\n\tinst, err := store.Inspect(ctx, instName)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif inst.Status != limatype.StatusRunning {\n\t\treturn fmt.Errorf(\"instance %q is not running (status: %s)\", instName, inst.Status)\n\t}\n\n\toutputPath, _ := cmd.Flags().GetString(\"output\")\n\tif outputPath == \"\" {\n\t\toutputPath = instName + \"-screenshot.png\"\n\t}\n\n\tvar format string\n\tswitch strings.ToLower(filepath.Ext(outputPath)) {\n\tcase \".png\":\n\t\tformat = \"png\"\n\tcase \".bmp\":\n\t\tformat = \"bmp\"\n\tdefault:\n\t\treturn fmt.Errorf(\"unsupported output extension %q: must be .png or .bmp\", filepath.Ext(outputPath))\n\t}\n\n\thaSock := filepath.Join(inst.Dir, filenames.HostAgentSock)","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/cmd/limactl/screenshot.go#L24-L60","documentation":"`limactl screenshot` needs a running guest to capture the screen. screenshotAction checks inst.Status from store.Inspect and refuses with \"instance %q is not running (status: %s)\" when the instance is in any state other than Running (stopped, broken, etc.).","triggerScenarios":"Running `limactl screenshot <instance>` while the instance is stopped, starting, broken, or after it crashed.","commonSituations":"Forgetting to start the VM; attempting a screenshot after a failed boot (status broken); scripting screenshots against an instance that has since shut down; status stale because the hostagent exited.","solutions":["Start the instance first: `limactl start <instance>`, then run `limactl screenshot <instance>`","If status is broken, inspect logs (`~/.lima/<instance>/ha.sock` logs / `limactl shell` unavailable) and repair the boot before screenshotting","Check current state with `limactl list` to confirm the status before retrying"],"exampleFix":"// before\nlimactl screenshot myvm            # myvm is stopped\n// after\nlimactl start myvm\nlimactl screenshot myvm","handlingStrategy":"validation","validationCode":"status=$(limactl list --format '{{.Status}}' \"$inst\" 2>/dev/null)\n[ \"$status\" = \"Running\" ] || { echo \"instance $inst not running (status: ${status:-missing})\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"if err := screenshotCmd.Run(); err != nil {\n    if strings.Contains(err.Error(), \"is not running\") {\n        // start the instance and retry the screenshot\n    }\n}","preventionTips":["Check `limactl list` status equals Running before screenshotting","Start instances programmatically before capture steps in CI","Handle broken/stopped states explicitly instead of screenshotting blind"],"tags":["screenshot","instance-status","not-running"],"backgroundTag":"instance-not-running","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}