{"record":{"id":"09b0204123806d21","repo":"gastownhall/beads","slug":"record-has-no-valid-pid","errorCode":null,"errorMessage":"record has no valid pid","messagePattern":"record has no valid pid","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/storage/dbproxy/proxy/endpoint.go","lineNumber":889,"sourceCode":"\tif checks.LegacyProxy && checks.LiveEstablished {\n\t\tstopGuidance = \"stop the pre-upgrade proxy with the old bd binary\"\n\t}\n\treturn &unverifiableLifecycleError{message: fmt.Sprintf(\n\t\t\"%s refused for unverifiable%s process pid %d recorded at %s: %v; %s, then quarantine the record manually by renaming %s to %s.stale-<unix-timestamp> before retrying\",\n\t\toperation,\n\t\tliveness,\n\t\tpid,\n\t\trecordPath,\n\t\tcause,\n\t\tstopGuidance,\n\t\trecordPath,\n\t\trecordPath,\n\t)}\n}\n\nfunc probeUnverifiablePID(pid int) (dead bool, live bool, err error) {\n\tif pid <= 0 {\n\t\treturn false, false, errors.New(\"record has no valid pid\")\n\t}\n\t_, err = procid.Capture(pid)\n\tif err == nil {\n\t\treturn false, true, nil\n\t}\n\tif procid.IsProcessGone(err) {\n\t\treturn true, false, nil\n\t}\n\treturn false, false, err\n}\n\nfunc openRecordedProcess(pf *pidfile.PidFile) (*procid.Handle, bool, error) {\n\thandle, err := procid.Open(pf.Pid, procid.Token(pf.Birth))\n\tif err == nil {\n\t\treturn handle, false, nil\n\t}\n\tif procid.IsProcessGone(err) {\n\t\treturn nil, true, nil","sourceCodeStart":871,"sourceCodeEnd":907,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/proxy/endpoint.go#L871-L907","documentation":"probeUnverifiablePID refuses to act on a pidfile record whose stored PID is zero or negative. Such a record carries no process identity, so liveness cannot be probed via procid.Capture and force-stop/shutdown logic must not guess. It is a sentinel-style input validation error produced by the cleanup/classification paths (cleanupOrphanBackend, classifyInvalidKillRecord).","triggerScenarios":"Calling ForceStopUnverified or orphan-cleanup code paths against a PID file whose 'pid' field is <= 0 (corrupted, hand-edited, or legacy/empty record).","commonSituations":"Corrupted or truncated pidfile after a crash; manually written test pidfiles; legacy record formats missing the pid field.","solutions":["Regenerate the PID file by starting the server/daemon so a valid PID is written","Delete the invalid PID file and let the proxy recreate it on next start","Add a pre-check that pid > 0 before passing records into force-stop/cleanup logic"],"exampleFix":"// before\nprobeUnverifiablePID(record.PID) // pid == 0 -> error\n// after\nif record.PID <= 0 {\n    os.Remove(recordPath) // drop invalid record\n    return\n}\nprobeUnverifiablePID(record.PID)","handlingStrategy":"validation","validationCode":"if record.PID <= 0 {\n    return fmt.Errorf(\"skipping record %s: no valid pid\", recordPath)\n}\ndead, live, err := probeUnverifiablePID(record.PID)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never write pidfiles with zero/negative PIDs","Validate pidfile records on read before acting on them","Drop or quarantine malformed records instead of probing them"],"tags":["go","pidfile","validation"],"backgroundTag":"invalid-pid-record","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}