Dokploy/dokploy · warning · TRPCError
NOT_FOUND
NOT_FOUND
Error message
Destination not found
What it means
findDestinationById queries the destinations table by destinationId and throws NOT_FOUND when no row matches. It is the standard 'resource does not exist' error for backup/upload destinations used across destination lookups.
Source
Thrown at packages/server/src/services/destination.ts:40
.returning()
.then((value) => value[0]);
if (!newDestination) {
throw new TRPCError({
code: "BAD_REQUEST",
message: "Error input: Inserting destination",
});
}
return newDestination;
};
export const findDestinationById = async (destinationId: string) => {
const destination = await db.query.destinations.findFirst({
where: and(eq(destinations.destinationId, destinationId)),
});
if (!destination) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Destination not found",
});
}
return destination;
};
export const removeDestinationById = async (
destinationId: string,
organizationId: string,
) => {
const result = await db
.delete(destinations)
.where(
and(
eq(destinations.destinationId, destinationId),
eq(destinations.organizationId, organizationId),
),View on GitHub (pinned to 546686ea35)
Solutions
- Verify the destination still exists (list destinations) and re-fetch fresh IDs
- Handle 404 by refreshing the destination list in the UI
- Check for environment mismatch (dev vs prod IDs)
- Guard calls with an existence check before dependent operations
Example fix
// before
const dest = await findDestinationById(id);
// after: check first and degrade gracefully
const exists = await db.query.destinations.findFirst({ where: eq(destinations.destinationId, id) });
if (!exists) {
// refresh list / prompt user instead of throwing
} Defensive patterns
Strategy: type-guard
Validate before calling
const row = await db.query.destinations.findFirst({ where: eq(destinations.destinationId, id) });
if (!row) { /* refresh destination list, don't call downstream ops */ } Type guard
const isDestination = (d: unknown): d is Destination => !!d && typeof (d as Destination).destinationId === "string";
Try / catch
try { return await findDestinationById(id); } catch (e) { if (e instanceof TRPCError && e.code === "NOT_FOUND") return null; throw e; } Prevention
- Refresh IDs after deletions or env re-provisioning
- Never hardcode destination IDs
- Handle 404 by reloading lists
When it happens
Trigger: Looking up a destination by an ID that doesn't exist: deleted destination, typo/truncated UUID, or an ID from a different database/environment.
Common situations: Stale UI lists after a destination was removed elsewhere; copying IDs between environments; frontend caching old destination references after re-provisioning the database.
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/dfdb17b70b6fd999.
Report an issue: GitHub.