{"record":{"id":"d16acddc4bad488c","repo":"Dokploy/dokploy","slug":"rollback-context-not-found","errorCode":null,"errorMessage":"Rollback context not found","messagePattern":"Rollback context not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/server/src/services/rollbacks.ts","lineNumber":175,"sourceCode":"\t\t}\n\t}\n\n\treturn rollback;\n};\n\nexport const rollback = async (rollbackId: string) => {\n\tconst result = await findRollbackById(rollbackId);\n\n\tconst deployment = await findDeploymentById(result.deploymentId);\n\n\tif (!deployment?.applicationId) {\n\t\tthrow new Error(\"Deployment not found\");\n\t}\n\n\tconst application = await findApplicationById(deployment.applicationId);\n\n\tif (!result.fullContext) {\n\t\tthrow new Error(\"Rollback context not found\");\n\t}\n\tawait rollbackApplication(\n\t\tapplication.appName,\n\t\tresult.image || \"\",\n\t\tapplication.serverId,\n\t\tresult.fullContext,\n\t);\n};\n\nconst dockerLoginForRegistry = async (\n\tregistry: Registry,\n\tserverId?: string | null,\n) => {\n\tconst loginCommand = safeDockerLoginCommand(\n\t\tregistry.registryUrl,\n\t\tregistry.username,\n\t\tregistry.password,\n\t);","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/rollbacks.ts#L157-L193","documentation":"rollback() requires result.fullContext — the application snapshot (including registry credentials) persisted by createRollback — to replay the deployment via rollbackApplication. If the column is null/empty, it throws 'Rollback context not found'. This happens for rollback rows whose fullContext update never ran (the transaction in createRollback failed after insert) or legacy rows created before fullContext existed.","triggerScenarios":"Executing a rollback whose createRollback transaction failed midway (row inserted via another path), a rollback row created by an older Dokploy version without fullContext, or manual DB edits nulling the column.","commonSituations":"Upgrading Dokploy across the version that introduced fullContext without backfilling old rollback rows; partial transaction failures leaving half-initialized rollbacks.","solutions":["Delete the stale rollback entry and create a fresh rollback from a current deployment (which will populate fullContext)","If upgrading, backfill or clear pre-fullContext rollback rows so the UI does not offer unusable rollbacks","Re-deploy the application and build a new rollback from that deployment"],"exampleFix":"// before\nif (!result.fullContext) {\n  throw new Error(\"Rollback context not found\");\n}\n\n// after\nif (!result.fullContext) {\n  throw new Error(\n    `Rollback ${rollbackId} has no stored context (created before snapshots or insert failed); delete it and create a new rollback`,\n  );\n}","handlingStrategy":"type-guard","validationCode":"const rb = await trpc.rollback.one.query(rollbackId);\nif (!rb?.fullContext) throw new Error(\"Rollback unusable: no stored context\");","typeGuard":"const isRollbackWithContext = (r: unknown): r is { fullContext: object } =>\n  typeof r === \"object\" && r !== null && (r as any).fullContext != null;","tryCatchPattern":"try { await rollback(rollbackId); } catch (e) { if (e instanceof Error && /Rollback context not found/.test(e.message)) { /* delete entry, create fresh rollback */ } throw e; }","preventionTips":["After upgrades, purge or backfill rollback rows lacking fullContext","Only offer rollbacks created by the current application version"],"tags":["dokploy","rollback","missing-context","data-migration"],"backgroundTag":"missing-stored-snapshot","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}