{"record":{"id":"2b7cf5c2527a2fd2","repo":"lima-vm/lima","slug":"exiting-status-v-hint-see-q","errorCode":null,"errorMessage":"exiting, status=%+v (hint: see %#q)","messagePattern":"exiting, status=%\\+v \\(hint: see %#q\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/instance/start.go","lineNumber":403,"sourceCode":"\t\t\tprogress := ev.Status.CloudInitProgress\n\t\t\tif progress.Active && progress.LogLine == \"\" {\n\t\t\t\tlogrus.Infof(\"Cloud-init provisioning started...\")\n\t\t\t}\n\n\t\t\tif progress.LogLine != \"\" {\n\t\t\t\tlogrus.Infof(\"[cloud-init] %s\", progress.LogLine)\n\t\t\t}\n\n\t\t\tif progress.Completed {\n\t\t\t\tcloudInitCompleted = true\n\t\t\t\tlogrus.Infof(\"Cloud-init progress monitoring done.\")\n\t\t\t}\n\t\t}\n\t\tif len(ev.Status.Errors) > 0 {\n\t\t\tlogrus.Errorf(\"%+v\", ev.Status.Errors)\n\t\t}\n\t\tif ev.Status.Exiting {\n\t\t\terr = fmt.Errorf(\"exiting, status=%+v (hint: see %#q)\", ev.Status, haStderrPath)\n\t\t\treturn true\n\t\t} else if ev.Status.Running {\n\t\t\treceivedRunningEvent = true\n\t\t\tif ev.Status.Degraded {\n\t\t\t\tlogrus.Warnf(\"DEGRADED. The VM seems running, but file sharing and port forwarding may not work. (hint: see %#q)\", haStderrPath)\n\t\t\t\terr = fmt.Errorf(\"degraded, status=%+v\", ev.Status)\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tif xerr := runAnsibleProvision(ctx, inst); xerr != nil {\n\t\t\t\terr = xerr\n\t\t\t\treturn true\n\t\t\t}\n\n\t\t\tif showProgress && !cloudInitCompleted {\n\t\t\t\treturn false\n\t\t\t}\n","sourceCodeStart":385,"sourceCodeEnd":421,"githubUrl":"https://github.com/lima-vm/lima/blob/dd909d0973cd84fa35f9e1693181b4585ea616c1/pkg/instance/start.go#L385-L421","documentation":"watchHostAgentEvents receives hostagent lifecycle events; when an event has Status.Exiting set, the hostagent reported it is exiting (usually after a fatal provisioning or startup error), and limactl converts the full status into this error, pointing at ha.stderr.log. The %+v of ev.Status includes errors and the last phase reported by the hostagent.","triggerScenarios":"Any `limactl start` where the hostagent emits an event with Exiting=true: failed provisioning scripts, fatal errors in port forwarding setup, guest agent never connecting, or explicit hostagent shutdown request.","commonSituations":"Broken provisioning in user-data/cloud-init scripts, invalid mount or network config in lima.yaml, guest image failing to boot, or `limactl stop` racing with `limactl start`.","solutions":["Read the ha.stderr.log path embedded in the error for the hostagent's fatal message","Fix provisioning errors reported in ev.Status.Errors (printed just above)","Validate lima.yaml fields (mounts, networks, provisioning scripts)","Recreate the instance with `limactl delete -f` if state is corrupted"],"exampleFix":"// before\nif err := lima.Start(ctx, inst); err != nil { return err }\n// after\nif err := lima.Start(ctx, inst); err != nil {\n    if strings.Contains(err.Error(), \"exiting, status=\") {\n        logrus.Errorf(\"hostagent exited; check %s\", haStderrPath)\n    }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"// parse the status embedded in the error\nre := regexp.MustCompile(`exiting, status=(.+?) \\(hint`)\nif m := re.FindStringSubmatch(err.Error()); m != nil { status := m[1] }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"exiting, status=\") {\n    // read ha.stderr.log referenced in the message and surface its tail to the user\n    b, _ := os.ReadFile(haStderrPath)\n    logrus.Errorf(\"hostagent exited: %s\", tail(b, 50))\n}","preventionTips":["Test provisioning scripts independently before adding to lima.yaml","Avoid racing `limactl stop` with `limactl start`","Validate mounts/networks config before start","Keep guest images up to date"],"tags":["hostagent","lifecycle","vm-startup"],"backgroundTag":"hostagent-exiting-event","analyzedSha":"dd909d0973cd84fa35f9e1693181b4585ea616c1","analyzedAt":"2026-09-01T14:24:59.842Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}