{"record":{"id":"76c421e8e37969e7","repo":"Dokploy/dokploy","slug":"rollback-not-found","errorCode":null,"errorMessage":"Rollback not found","messagePattern":"Rollback not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/services/rollbacks.ts","lineNumber":116,"sourceCode":"\n\t\tconst updatedRollback = await tx.query.rollbacks.findFirst({\n\t\t\twhere: eq(rollbacks.rollbackId, rollback.rollbackId),\n\t\t});\n\n\t\treturn updatedRollback;\n\t});\n};\n\nexport const findRollbackById = async (rollbackId: string) => {\n\tconst result = await db.query.rollbacks.findFirst({\n\t\twhere: eq(rollbacks.rollbackId, rollbackId),\n\t\twith: {\n\t\t\tdeployment: true,\n\t\t},\n\t});\n\n\tif (!result) {\n\t\tthrow new Error(\"Rollback not found\");\n\t}\n\n\treturn result;\n};\n\nconst deleteRollbackImage = async (image: string, serverId?: string | null) => {\n\tconst command = `docker image rm ${image} --force`;\n\n\tif (serverId) {\n\t\tawait execAsyncRemote(serverId, command);\n\t} else {\n\t\tawait execAsync(command);\n\t}\n};\n\nexport const removeRollbackById = async (rollbackId: string) => {\n\tconst rollback = await findRollbackById(rollbackId);\n","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/rollbacks.ts#L98-L134","documentation":"findRollbackById is the shared lookup for rollback records (with the deployment relation). No matching row throws a plain Error 'Rollback not found'. It backs the `rollback` and `result` tRPC procedures, so both listing a rollback's result and executing a rollback pass through it.","triggerScenarios":"Querying or executing a rollbackId that does not exist — deleted via removeRollbackById, typo'd ID, or DB reset.","commonSituations":"Stale rollback list in the UI after another user removed the rollback; scripts calling rollback() with an old ID.","solutions":["Re-fetch the rollback list for the application to get valid IDs","Wrap calls and treat 'Rollback not found' as a benign stale-reference case","Ensure only one session removes rollbacks while others use them"],"exampleFix":"// before\nawait rollback(rollbackId);\n\n// after\ntry {\n  await rollback(rollbackId);\n} catch (e: any) {\n  if (/Rollback not found/.test(e?.message ?? \"\")) {\n    console.warn(\"Rollback already removed; refreshing list\");\n    return;\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"const list = await trpc.rollback.byApp.query(appId); // verify the ID is currently offered","typeGuard":"const isRollbackNotFound = (e: unknown): boolean =>\n  e instanceof Error && /Rollback not found/.test(e.message);","tryCatchPattern":"try { await rollback(rollbackId); } catch (e) { if (isRollbackNotFound(e)) { /* refresh list */ return; } throw e; }","preventionTips":["Re-fetch rollback lists before acting on them","Guard against concurrent removal of rollbacks across sessions"],"tags":["dokploy","rollback","not-found"],"backgroundTag":"resource-not-found","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}