{"record":{"id":"9000af51b364171f","repo":"paperclipai/paperclip","slug":"cannot-restart-status-servicename-supervisor-d","errorCode":null,"errorMessage":"Cannot restart ${status.serviceName}: supervisor did not report a server pid.","messagePattern":"Cannot restart (.+?): supervisor did not report a server pid\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/service.ts","lineNumber":120,"sourceCode":"      await new Promise((resolve) => setTimeout(resolve, pollMs));\n    }\n  }\n\n  try {\n    return await callback();\n  } finally {\n    try {\n      if ((await fs.readFile(lockPath, \"utf8\")).trim() === token) {\n        await fs.rm(lockPath, { force: true });\n      }\n    } catch (error) {\n      if ((error as NodeJS.ErrnoException).code !== \"ENOENT\") throw error;\n    }\n  }\n}\n\nasync function writeHotRestartIntent(status: ServiceStatus, instanceId: string, drainRequired: boolean): Promise<{ requestedAt: string }> {\n  if (!status.pid) throw new Error(`Cannot restart ${status.serviceName}: supervisor did not report a server pid.`);\n  const health = await probeHealth(instanceId);\n  const instanceRoot = resolvePaperclipInstanceRoot(instanceId);\n  const requestedAt = new Date().toISOString();\n  await fs.mkdir(instanceRoot, { recursive: true });\n  await fs.rm(path.join(instanceRoot, \"hot-restart-report.json\"), { force: true });\n  await fs.writeFile(path.join(instanceRoot, \"hot-restart-intent.json\"), `${JSON.stringify({\n    version: 1,\n    requestedAt,\n    previousServerPid: status.pid,\n    previousServerVersion: health.serverVersion,\n    drainRequired,\n    requestedByRunId: process.env.PAPERCLIP_RUN_ID?.trim() || null,\n  }, null, 2)}\\n`, \"utf8\");\n  return { requestedAt };\n}\n\nasync function waitForRestartReport(instanceId: string, requestedAt: string, timeoutMs = 10_000): Promise<unknown | null> {\n  const reportPath = path.join(resolvePaperclipInstanceRoot(instanceId), \"hot-restart-report.json\");","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/service.ts#L102-L138","documentation":"writeHotRestartIntent needs the running server's pid to signal a hot restart, but the service status reported none, so the restart intent cannot be delivered.","triggerScenarios":"Thrown at cli/src/commands/service.ts:120 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the supervisor/service status; start the service or reinstall it so a pid is reported."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}