{"record":{"id":"f66319f81ed6b1fb","repo":"paperclipai/paperclip","slug":"worker-already-registered-for-plugin-pluginid","errorCode":null,"errorMessage":"Worker already registered for plugin \"${pluginId}\" (status: ${existing.status})","messagePattern":"Worker already registered for plugin \"(.+?)\" \\(status: (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":400,"severity":"error","filePath":"server/src/services/plugin-worker-manager.ts","lineNumber":3016,"sourceCode":"    // Unexpected exit — crash recovery\n    totalCrashes++;\n    const now = Date.now();\n\n    // Reset consecutive crash counter if enough time passed\n    if (lastCrashAt !== null && now - lastCrashAt > CRASH_WINDOW_MS) {\n      consecutiveCrashes = 0;\n    }\n    consecutiveCrashes++;\n    lastCrashAt = now;\n\n    log.error(\n      { code, signal, consecutiveCrashes, totalCrashes },\n      \"worker process crashed\",\n    );\n\n    const willRestart =\n      autoRestart && consecutiveCrashes <= MAX_CONSECUTIVE_CRASHES;\n\n    setStatus(\"crashed\");\n    emitter.emit(\"crash\", { pluginId, code, signal, willRestart });\n\n    if (willRestart) {\n      scheduleRestart();\n    } else {\n      log.error(\n        { consecutiveCrashes, maxCrashes: MAX_CONSECUTIVE_CRASHES },\n        \"max consecutive crashes reached, not restarting\",\n      );\n    }\n  }\n\n  function rejectAllPending(error: Error): void {\n    for (const [id, pending] of pendingRequests) {\n      clearTimeout(pending.timer);\n      pending.resolve(\n        createErrorResponse(","sourceCodeStart":2998,"sourceCodeEnd":3034,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/plugin-worker-manager.ts#L2998-L3034","documentation":"The worker registry already has a handle registered for this pluginId when registering a new one. Indicates a spawn/registration race; the existing worker's status is reported so the duplicate can be reconciled.","triggerScenarios":"Thrown at server/src/services/plugin-worker-manager.ts:2198 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["A worker is already registered for this plugin. Stop or deregister the existing worker before registering a new one."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}