{"record":{"id":"2e42fbfea5d7dc40","repo":"abiosoft/colima","slug":"process-not-found-v","errorCode":null,"errorMessage":"process not found: %v","messagePattern":"process not found: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/daemon/daemon.go","lineNumber":130,"sourceCode":"func 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 {\n\t\treturn fmt.Errorf(\"process signal(0) returned error: %w\", err)\n\t}\n\n\treturn nil\n}\n\nconst (\n\tpidFileName = \"daemon.pid\"\n\tlogFileName = \"daemon.log\"\n)\n\nfunc Info() struct {\n\tPidFile string\n\tLogFile string\n} {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/abiosoft/colima/blob/c3a5f9184d83a197184f897a9f07eb3c01b3bc88/cmd/daemon/daemon.go#L112-L148","documentation":"Returned when os.FindProcess(pid) fails after the pid file parsed to a nonzero pid. On Unix (macOS/Linux, colima's supported hosts) os.FindProcess ALWAYS succeeds and returns a non-nil *Process even for nonexistent pids — liveness validation is deferred to Signal(0). This error is therefore effectively unreachable on Unix and only fires on Windows, where FindProcess actually checks process existence.","triggerScenarios":"Porting or running the colima daemon tooling on a Windows host; a pid file referencing a pid that does not exist on a platform where FindProcess validates. On darwin/linux this branch is dead code.","commonSituations":"Experimental Windows builds of colima tooling; CI runners attempting daemon status on windows; almost never seen in normal macOS/Linux usage.","solutions":["On macOS/Linux treat this as impossible — if you see it, the platform is not Unix: switch to a supported host","Delete the stale pid file and restart the daemon: rm dir()/daemon.pid, then `colima daemon start`","If Windows support is intended, gate this branch with runtime.GOOS and rely on the Signal(0) check instead"],"exampleFix":"// before\nprocess, err := os.FindProcess(pid)\nif err != nil {\n    return fmt.Errorf(\"process not found: %v\", err)\n}\n\n// after\n// on unix FindProcess never errors; keep the check but include the pid and wrap the cause\nprocess, err := os.FindProcess(pid)\nif err != nil {\n    return fmt.Errorf(\"process %d not found: %w\", pid, err)\n}","handlingStrategy":"validation","validationCode":"// on unix this branch is unreachable; if you must be defensive:\nif runtime.GOOS == \"windows\" {\n    if p, err := os.FindProcess(pid); err != nil || p == nil {\n        // pid invalid on this platform; treat the pid file as stale\n        _ = os.Remove(info.PidFile)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run colima daemon tooling on supported Unix hosts (macOS/Linux) where os.FindProcess cannot fail","Treat any occurrence of this error as a platform smell, not a daemon problem — check runtime.GOOS before debugging process state"],"tags":["go","colima","daemon","portability","process"],"backgroundTag":null,"analyzedSha":"c3a5f9184d83a197184f897a9f07eb3c01b3bc88","analyzedAt":"2026-08-15T18:58:08.334Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}