{"record":{"id":"aae7e437867a33e4","repo":"rohitg00/agentmemory","slug":"eperm","errorCode":"EPERM","errorMessage":"No permission to signal pid ${pid}. Try: kill ${pid}","messagePattern":"No permission to signal pid (.+?)\\. Try: kill (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli.ts","lineNumber":3265,"sourceCode":"    }\n    return true;\n  } catch (err) {\n    return (err as NodeJS.ErrnoException)?.code === \"EPERM\";\n  }\n}\n\nasync function signalAndWait(\n  pid: number,\n  initialSignal: NodeJS.Signals,\n  timeoutMs: number,\n): Promise<boolean> {\n  try {\n    process.kill(pid, initialSignal);\n  } catch (err) {\n    const code = (err as NodeJS.ErrnoException)?.code;\n    if (code === \"ESRCH\") return true;\n    if (code === \"EPERM\") {\n      p.log.warn(`No permission to signal pid ${pid}. Try: kill ${pid}`);\n      return false;\n    }\n    vlog(`${initialSignal} ${pid}: ${err instanceof Error ? err.message : String(err)}`);\n    return false;\n  }\n  const deadline = Date.now() + timeoutMs;\n  while (Date.now() < deadline) {\n    if (!pidAlive(pid)) return true;\n    await new Promise((r) => setTimeout(r, 200));\n  }\n  if (!pidAlive(pid)) return true;\n  try {\n    process.kill(pid, \"SIGKILL\");\n  } catch (err) {\n    if ((err as NodeJS.ErrnoException)?.code === \"ESRCH\") return true;\n    vlog(`SIGKILL ${pid}: ${err instanceof Error ? err.message : String(err)}`);\n    return false;\n  }","sourceCodeStart":3247,"sourceCodeEnd":3283,"githubUrl":"https://github.com/rohitg00/agentmemory/blob/e04ba88819c365c9acf9d6661ea802143e728bd6/src/cli.ts#L3247-L3283","documentation":"Warning from the stop/kill routine when process.kill(pid, signal) fails with EPERM — the OS refused to signal the target process because the current user lacks permission. The engine is NOT stopped by this attempt.","triggerScenarios":"Calling the stop command where the recorded/listed pid belongs to a process owned by another user (e.g. a daemon started by root or another account).","commonSituations":"Engine previously started with sudo, mixed-user installs, containers where the pid is owned by a different uid, shared dev servers.","solutions":["Run the same kill command with sudo: `sudo kill <pid>`","Stop the process as the user who started it (log in as that user and stop the engine)","If it is a stale foreign pidfile, remove ~/.agentmemory/iii.pid after confirming the process is not yours"],"exampleFix":"// before\n$ agentmemory stop\nwarn: No permission to signal pid 4321. Try: kill 4321\n// after\n$ sudo kill 4321","handlingStrategy":"try-catch","validationCode":"const os = require(\"os\");\nfunction canSignal(pid) { try { process.kill(pid, 0); return true; } catch (e) { return e.code === \"EPERM\" ? \"eprem\" : false; } }","typeGuard":"function isEperm(e: unknown): e is NodeJS.ErrnoException { return (e as NodeJS.ErrnoException)?.code === \"EPERM\"; }","tryCatchPattern":"try { process.kill(pid, signal); } catch (err) {\n  if ((err as NodeJS.ErrnoException)?.code === \"EPERM\") {\n    console.warn(`Permission denied for pid ${pid}; retry with sudo kill ${pid}`);\n  }\n}","preventionTips":["Run the engine as the same user that later stops it","Avoid starting the daemon with sudo","Check pid ownership (ps -o user -p <pid>) before killing"],"tags":["process","permissions","epxerm","kill"],"backgroundTag":"operation-not-permitted","analyzedSha":"e04ba88819c365c9acf9d6661ea802143e728bd6","analyzedAt":"2026-08-30T01:07:40.754Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}