{"record":{"id":"abacf5b6260d944c","repo":"paperclipai/paperclip","slug":"failed-to-archive-execution-workspace-failurere","errorCode":null,"errorMessage":"Failed to archive execution workspace: ${failureReason}","messagePattern":"Failed to archive execution workspace: (.+?)","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/src/routes/execution-workspaces.ts","lineNumber":1341,"sourceCode":"        }\n      } catch (error) {\n        const failureReason = error instanceof Error ? error.message : String(error);\n        // Mark cleanup_failed only while the row is still closed at the captured\n        // generation. If a resume reopened the workspace after the cleanup threw,\n        // the row is active again and, after a fresh archive, carries a higher\n        // generation. The generation-fenced write skips the row in both cases, so\n        // a stale cleanup_failed write never overwrites the newer active lifecycle\n        // state, and never buries a newer archive under the first archive's\n        // failure.\n        const marked = await svc.applyClosedWorkspaceCleanupOutcome({\n          id,\n          closedAt,\n          capturedGeneration,\n          cleanupReason: failureReason,\n          markCleanupFailed: true,\n        });\n        if (marked) workspace = marked;\n        res.status(500).json({\n          error: `Failed to archive execution workspace: ${failureReason}`,\n        });\n        return;\n      }\n    } else {\n      const updatedWorkspace = await svc.update(id, patch);\n      if (!updatedWorkspace) {\n        res.status(404).json({ error: \"Execution workspace not found\" });\n        return;\n      }\n      workspace = updatedWorkspace;\n    }\n    const actor = getActorInfo(req);\n    await logActivity(db, {\n      companyId: existing.companyId,\n      actorType: actor.actorType,\n      actorId: actor.actorId,\n      agentId: actor.agentId,","sourceCodeStart":1323,"sourceCodeEnd":1359,"githubUrl":"https://github.com/paperclipai/paperclip/blob/a7e689b3c35347b529cb9f54c9b9a8575a3dcab6/server/src/routes/execution-workspaces.ts#L1323-L1359","documentation":"Post-archive cleanup threw and the failure was captured as failureReason; the row is marked cleanup_failed only if it is still closed at the captured generation, otherwise the message records why the archive pipeline did not complete cleanly.","triggerScenarios":"Thrown at server/src/routes/execution-workspaces.ts:909 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the health/connectivity of the backing service (database, dev server supervisor, storage), fix the underlying fault, and retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a7e689b3c35347b529cb9f54c9b9a8575a3dcab6","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}