Dokploy/dokploy · error · TRPCError

NOT_FOUND

NOT_FOUND

Error message

Redirect not found

What it means

findRedirectById looks up a redirect row by redirectId and throws NOT_FOUND when none exists. It is the standard lookup guard for redirect read/update/delete flows; the id supplied does not match any redirect record.

Source

Thrown at packages/server/src/services/redirect.ts:19

import { db } from "@dokploy/server/db";
import { type apiCreateRedirect, redirects } from "@dokploy/server/db/schema";
import {
	createRedirectMiddleware,
	removeRedirectMiddleware,
	updateRedirectMiddleware,
} from "@dokploy/server/utils/traefik/redirect";
import { TRPCError } from "@trpc/server";
import { eq } from "drizzle-orm";
import type { z } from "zod";
import { findApplicationById } from "./application";
export type Redirect = typeof redirects.$inferSelect;

export const findRedirectById = async (redirectId: string) => {
	const application = await db.query.redirects.findFirst({
		where: eq(redirects.redirectId, redirectId),
	});
	if (!application) {
		throw new TRPCError({
			code: "NOT_FOUND",
			message: "Redirect not found",
		});
	}
	return application;
};

export const createRedirect = async (
	redirectData: z.infer<typeof apiCreateRedirect>,
) => {
	try {
		await db.transaction(async (tx) => {
			const redirect = await tx
				.insert(redirects)
				.values({
					...redirectData,
				})
				.returning()

View on GitHub (pinned to 546686ea35)

Solutions

  1. Verify the redirect exists by re-fetching the redirects list for the application
  2. Refresh client state and retry with a current redirectId
  3. If it should exist, check the redirects table for the id
Defensive patterns

Strategy: try-catch

Validate before calling

const list = await listRedirects(applicationId);
if (!list.some(r => r.redirectId === redirectId)) { /* drop stale reference */ }

Try / catch

try { await findRedirectById(id) } catch (e) { if (e instanceof TRPCError && e.code === 'NOT_FOUND') { /* remove from local list */ } }

Prevention

When it happens

Trigger: Calling a redirect operation (read/update/delete) with a redirectId that doesn't exist, was already deleted, or is malformed.

Common situations: Redirect was deleted in another tab but the list state is stale; copy-paste/truncated UUID in direct API calls; concurrent delete racing a read/update.

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/3ba3b84ece625db7. Report an issue: GitHub.