Dokploy/dokploy · error · Error

Rollback not found

Error message

Rollback not found

What it means

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.

Source

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

		const updatedRollback = await tx.query.rollbacks.findFirst({
			where: eq(rollbacks.rollbackId, rollback.rollbackId),
		});

		return updatedRollback;
	});
};

export const findRollbackById = async (rollbackId: string) => {
	const result = await db.query.rollbacks.findFirst({
		where: eq(rollbacks.rollbackId, rollbackId),
		with: {
			deployment: true,
		},
	});

	if (!result) {
		throw new Error("Rollback not found");
	}

	return result;
};

const deleteRollbackImage = async (image: string, serverId?: string | null) => {
	const command = `docker image rm ${image} --force`;

	if (serverId) {
		await execAsyncRemote(serverId, command);
	} else {
		await execAsync(command);
	}
};

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

View on GitHub (pinned to 546686ea35)

Solutions

  1. Re-fetch the rollback list for the application to get valid IDs
  2. Wrap calls and treat 'Rollback not found' as a benign stale-reference case
  3. Ensure only one session removes rollbacks while others use them

Example fix

// before
await rollback(rollbackId);

// after
try {
  await rollback(rollbackId);
} catch (e: any) {
  if (/Rollback not found/.test(e?.message ?? "")) {
    console.warn("Rollback already removed; refreshing list");
    return;
  }
  throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

const list = await trpc.rollback.byApp.query(appId); // verify the ID is currently offered

Type guard

const isRollbackNotFound = (e: unknown): boolean =>
  e instanceof Error && /Rollback not found/.test(e.message);

Try / catch

try { await rollback(rollbackId); } catch (e) { if (isRollbackNotFound(e)) { /* refresh list */ return; } throw e; }

Prevention

When it happens

Trigger: Querying or executing a rollbackId that does not exist — deleted via removeRollbackById, typo'd ID, or DB reset.

Common situations: Stale rollback list in the UI after another user removed the rollback; scripts calling rollback() with an old ID.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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