{"record":{"id":"83c25ffcda82c3b0","repo":"paperclipai/paperclip","slug":"manager-servicename-is-still-loaded-after-unins","errorCode":null,"errorMessage":"${manager.serviceName} is still loaded after uninstall.","messagePattern":"(.+?) is still loaded after uninstall\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/service.ts","lineNumber":191,"sourceCode":"    .action(async (opts) => {\n      const manager = await resolveManager(opts); if (!manager) return;\n      const result = await manager.install({ startNow: opts.startNow, startOnLogin: opts.startOnLogin });\n      let lingerEnabled = false;\n      if (manager.enableLinger) {\n        let consent = opts.enableLinger === true;\n        if (!consent && process.stdin.isTTY && process.stdout.isTTY) {\n          consent = await p.confirm({ message: \"Allow Paperclip to run without an active login session? This runs 'loginctl enable-linger' for your user and may request system authorization.\", initialValue: false }) === true;\n        }\n        if (consent) { await manager.enableLinger(); lingerEnabled = true; }\n      }\n      output({ installed: true, changed: result.changed, platform: manager.platform, serviceName: manager.serviceName, definitionPath: manager.definitionPath, lingerEnabled }, opts.json);\n    });\n\n  common(service.command(\"uninstall\").description(\"Stop, disable, and remove the background service\")).action(async (opts) => {\n    const manager = await resolveManager(opts); if (!manager) return;\n    await manager.uninstall();\n    const status = await manager.status();\n    if (status.installed || status.active) throw new Error(`${manager.serviceName} is still loaded after uninstall.`);\n    output({ uninstalled: true, serviceName: manager.serviceName }, opts.json);\n  });\n\n  for (const verb of [\"start\", \"stop\"] as const) {\n    common(service.command(verb).description(`${verb === \"start\" ? \"Start\" : \"Stop\"} the background service`)).action(async (opts) => {\n      const manager = await resolveManager(opts); if (!manager) return;\n      await manager[verb]();\n      output(await manager.status(), opts.json);\n    });\n  }\n\n  common(service.command(\"restart\").description(\"Hot-restart the service while preserving active agent runs\"))\n    .option(\"--wait\", \"Wait for active runs to drain instead of adopting them\", false)\n    .option(\"--expected-version <version>\", \"Require the restarted server to report this version\")\n    .action(async (opts) => output(await restartManagedService({ instanceId: opts.instance, expectedVersion: opts.expectedVersion, waitForDrain: opts.wait }), opts.json));\n\n  common(service.command(\"status\").description(\"Show supervisor and health status\")).action(async (opts) => {\n    const manager = await resolveManager(opts); if (!manager) return;","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/service.ts#L173-L209","documentation":"Thrown by the `service uninstall` action after calling manager.uninstall() and re-checking status: the service is still reported as installed or active, meaning uninstall did not fully remove it. This catches supervisor cleanup failures.","triggerScenarios":"Running `paperclipai service uninstall` where the manager's uninstall returned but `status()` still reports `installed` or `active`. Causes: unit file left on disk, service still running because stop failed, permission denied removing the unit, or the supervisor cache is stale.","commonSituations":"Permission issues removing a system unit (needs sudo), service busy with active connections so it could not stop, a second install raced the uninstall, or a partially-managed unit the manager cannot fully remove.","solutions":["Stop the service explicitly first: `paperclipai service stop`, then uninstall again.","Remove the unit file manually if permissions blocked it (the definitionPath is in manager output); may need elevated privileges.","Re-run `paperclipai service status` to see residual state, then `paperclipai service uninstall` again.","Check manager logs for the underlying uninstall error."],"exampleFix":"# before\npaperclipai service uninstall  # still loaded\n# after\npaperclipai service stop\nsudo rm \"$(paperclipai service status | jq -r .definitionPath)\"\npaperclipai service uninstall","handlingStrategy":"try-catch","validationCode":"async function ensureUninstalled(manager: ServiceManager): Promise<void> {\n  await manager.uninstall();\n  const s = await manager.status();\n  if (s.installed || s.active) throw new Error(`${manager.serviceName} still loaded.`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await manager.uninstall();\n} catch (err) {\n  console.error('Uninstall failed; stop service then retry:', err);\n  await manager.stop();\n  await manager.uninstall();\n}","preventionTips":["Stop the service before uninstalling to avoid busy-state cleanup failures.","Run uninstall with sufficient privileges to remove system unit files."],"tags":["service","uninstall","cleanup","supervisor","permissions"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}