{"record":{"id":"73404c72d062c764","repo":"abiosoft/colima","slug":"pid-file-not-found-w","errorCode":null,"errorMessage":"pid file not found: %w","messagePattern":"pid file not found: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"cmd/daemon/daemon.go","lineNumber":115,"sourceCode":"\tfor {\n\t\talive := status() == nil\n\t\tif !alive {\n\t\t\treturn nil\n\t\t}\n\t\tselect {\n\t\tcase <-ctx.Done():\n\t\t\treturn ctx.Err()\n\t\tdefault:\n\t\t\ttime.Sleep(time.Second * 1)\n\t\t}\n\t}\n\n}\n\nfunc status() error {\n\tinfo := Info()\n\tif _, err := os.Stat(info.PidFile); err != nil {\n\t\treturn fmt.Errorf(\"pid file not found: %w\", err)\n\t}\n\n\t// check if process is actually running\n\tp, err := os.ReadFile(info.PidFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading pid file: %w\", err)\n\t}\n\tpid, _ := strconv.Atoi(string(p))\n\tif pid == 0 {\n\t\treturn fmt.Errorf(\"invalid pid: %v\", string(p))\n\t}\n\n\tprocess, err := os.FindProcess(pid)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"process not found: %v\", err)\n\t}\n\n\tif err := process.Signal(syscall.Signal(0)); err != nil {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/daemon/daemon.go#L97-L133","documentation":"Returned by status (cmd/daemon/daemon.go:115) when os.Stat fails on the daemon pid file (daemon.pid in the daemon directory). Within colima this is less an error than the 'daemon not running' sentinel: start() treats a non-nil status() result as not-running and proceeds, and stop() returns nil early.","triggerScenarios":"Any status/start/stop flow before the daemon has ever been started; the daemon crashed without cleaning up its pid file; cleanup tools removed the pid file; the daemon directory was deleted.","commonSituations":"Checking daemon status on a fresh install; inspecting the daemon after a colima uninstall/reinstall; log inspection showing this error although nothing is actually wrong.","solutions":["No action needed if the daemon is expected to be stopped — this message means 'not running'","To have it running, start colima normally (features needing the daemon start it on demand) and re-check status","If it should be running, the daemon died earlier — inspect daemon.log in the same directory for the cause"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Interpret missing pid file as 'not running' instead of an error\ninfo := daemon.Info()\nif _, err := os.Stat(info.PidFile); os.IsNotExist(err) {\n    // daemon not running — proceed with start or report stopped status\n}","typeGuard":"// Classify daemon status outcomes\nfunc daemonNotRunning(err error) bool {\n    return err != nil && strings.HasPrefix(err.Error(), \"pid file not found\")\n}","tryCatchPattern":"if err := daemonStatus(); err != nil {\n    if daemonNotRunning(err) {\n        // expected state on fresh installs — not a fault\n        return stoppedState, nil\n    }\n    return err\n}","preventionTips":["Expect this message on fresh installs or after uninstalls — it is a sentinel, not a fault","Start the daemon implicitly by using features that require it, then re-check status","If the daemon should be running, look at daemon.log beside the pid file for the real crash cause"],"tags":["daemon","status","pidfile","colima","go"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}