Dokploy/dokploy · error · Error

Rollback context not found

Error message

Rollback context not found

What it means

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.

Source

Thrown at packages/server/src/services/rollbacks.ts:175

		}
	}

	return rollback;
};

export const rollback = async (rollbackId: string) => {
	const result = await findRollbackById(rollbackId);

	const deployment = await findDeploymentById(result.deploymentId);

	if (!deployment?.applicationId) {
		throw new Error("Deployment not found");
	}

	const application = await findApplicationById(deployment.applicationId);

	if (!result.fullContext) {
		throw new Error("Rollback context not found");
	}
	await rollbackApplication(
		application.appName,
		result.image || "",
		application.serverId,
		result.fullContext,
	);
};

const dockerLoginForRegistry = async (
	registry: Registry,
	serverId?: string | null,
) => {
	const loginCommand = safeDockerLoginCommand(
		registry.registryUrl,
		registry.username,
		registry.password,
	);

View on GitHub (pinned to 546686ea35)

Solutions

  1. Delete the stale rollback entry and create a fresh rollback from a current deployment (which will populate fullContext)
  2. If upgrading, backfill or clear pre-fullContext rollback rows so the UI does not offer unusable rollbacks
  3. Re-deploy the application and build a new rollback from that deployment

Example fix

// before
if (!result.fullContext) {
  throw new Error("Rollback context not found");
}

// after
if (!result.fullContext) {
  throw new Error(
    `Rollback ${rollbackId} has no stored context (created before snapshots or insert failed); delete it and create a new rollback`,
  );
}
Defensive patterns

Strategy: type-guard

Validate before calling

const rb = await trpc.rollback.one.query(rollbackId);
if (!rb?.fullContext) throw new Error("Rollback unusable: no stored context");

Type guard

const isRollbackWithContext = (r: unknown): r is { fullContext: object } =>
  typeof r === "object" && r !== null && (r as any).fullContext != null;

Try / catch

try { await rollback(rollbackId); } catch (e) { if (e instanceof Error && /Rollback context not found/.test(e.message)) { /* delete entry, create fresh rollback */ } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: Upgrading Dokploy across the version that introduced fullContext without backfilling old rollback rows; partial transaction failures leaving half-initialized rollbacks.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/d16acddc4bad488c. Report an issue: GitHub.