{"record":{"id":"571df02f4796d840","repo":"gastownhall/beads","slug":"proxy-forcestopunverified-refusing-to-signal-pid-571df0","errorCode":null,"errorMessage":"proxy.ForceStopUnverified: refusing to signal pid %d from %s: its command line does not reference workspace %s, so it may be an unrelated %s process; stop it manually if it is yours, then quarantine the record by renaming %s to %s.stale-<unix-timestamp> before retrying","messagePattern":"proxy\\.ForceStopUnverified: refusing to signal pid (.+?) from (.+?): its command line does not reference workspace (.+?), so it may be an unrelated (.+?) process; stop it manually if it is yours, then quarantine the record by renaming (.+?) to (.+?)\\.stale-<unix-timestamp> before retrying","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"internal/storage/dbproxy/proxy/force_stop.go","lineNumber":244,"sourceCode":"\t// dolt be killed; require the command line to tie the process to THIS\n\t// workspace, and refuse when that scope cannot be established.\n\tscoped, gone, err := proc.commandLineContains(rootDir)\n\tif err != nil {\n\t\treturn fmt.Errorf(\n\t\t\t\"proxy.ForceStopUnverified: refusing to signal pid %d from %s: workspace scope could not be established (%v); stop the process manually, then quarantine the record by renaming %s to %s.stale-<unix-timestamp> before retrying\",\n\t\t\tpid,\n\t\t\treport.RecordPath,\n\t\t\terr,\n\t\t\treport.RecordPath,\n\t\t\treport.RecordPath,\n\t\t)\n\t}\n\tif gone {\n\t\treport.ProcessWasGone = true\n\t\treturn nil\n\t}\n\tif !scoped {\n\t\treturn fmt.Errorf(\n\t\t\t\"proxy.ForceStopUnverified: refusing to signal pid %d from %s: its command line does not reference workspace %s, so it may be an unrelated %s process; stop it manually if it is yours, then quarantine the record by renaming %s to %s.stale-<unix-timestamp> before retrying\",\n\t\t\tpid,\n\t\t\treport.RecordPath,\n\t\t\trootDir,\n\t\t\texecutable,\n\t\t\treport.RecordPath,\n\t\t\treport.RecordPath,\n\t\t)\n\t}\n\n\tgone, err = proc.kill()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"proxy.ForceStopUnverified: signal pid %d: %w\", pid, err)\n\t}\n\tif gone {\n\t\treport.ProcessWasGone = true\n\t\treturn nil\n\t}","sourceCodeStart":226,"sourceCodeEnd":262,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/dbproxy/proxy/force_stop.go#L226-L262","documentation":"The process IS a bd or dolt binary, but its command line does not mention the current workspace root, so it may belong to a different workspace. ForceStopUnverified refuses to signal it to avoid killing an unrelated bd/dolt process whose PID was recycled into this record. The error names the exact quarantine rename to perform before retrying.","triggerScenarios":"proxy.ForceStopUnverified where the PID now belongs to a bd/dolt process launched from a DIFFERENT workspace directory (PID reuse after the original daemon died), or the daemon was started with a command line that does not include the workspace path (e.g. launched with a relative path from elsewhere or via a wrapper that rewrote argv).","commonSituations":"Two workspaces on one machine sharing recycled PIDs; daemons started with argv rewritten by containers/wrappers so the root dir string no longer appears in cmdline; snapshot/restored environments where pid files outlive their processes.","solutions":["Confirm with ps -p <pid> -o args= whether the process belongs to this workspace; if it is another workspace's daemon, leave it alone","If it is yours and unrelated, stop it manually (kill <pid>)","Quarantine the stale record: rename <record> to <record>.stale-<unix-timestamp>, then retry force-stop","Ensure the daemon for THIS workspace is started in a way that its cmdline includes the workspace root (launch from the workspace directory)"],"exampleFix":"// before: blanket-killing the pid\nkill -9 $(cat .bd/bd.pid)\n// after: verify, quarantine, retry\nps -p $(cat .bd/bd.pid) -o args=\nmv .bd/bd.pid .bd/bd.pid.stale-$(date +%s)\nbd daemon --force-stop","handlingStrategy":"validation","validationCode":"// verify the pid's cmdline belongs to THIS workspace before force-stop\npid := readPidFromRecord(recordPath)\nout, _ := exec.Command(\"ps\", \"-p\", fmt.Sprint(pid), \"-o\", \"args=\").Output()\nif !strings.Contains(string(out), rootDir) {\n    // belongs to another workspace or recycled: quarantine, never kill blindly\n    os.Rename(recordPath, recordPath+\".stale-\"+fmt.Sprint(time.Now().Unix()))\n    return nil\n}","typeGuard":"func isForeignWorkspaceErr(err error) bool {\n    return err != nil && strings.Contains(err.Error(), \"does not reference workspace\")\n}","tryCatchPattern":null,"preventionTips":["Start each workspace's daemon from its own root directory so argv contains the workspace path","Avoid wrappers/launchers that rewrite argv and drop the workspace path","Use unique workspace directories to reduce cross-workspace PID collisions after restarts","Treat this refusal as a stop-sign: verify with ps before ever killing the PID yourself"],"tags":["pid-recycling","workspace-scope","safety-guard","force-stop"],"backgroundTag":"pid-belongs-to-other-workspace","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}