Dokploy/dokploy · error · TRPCError
NOT_FOUND
NOT_FOUND
Error message
Organization not found
What it means
Existence check at the top of the update-organization mutation: it queries the organization table by id and throws NOT_FOUND when no row matches. The organization was deleted, the id is wrong (or from another instance), or it's a UUID typo/paste error.
Source
Thrown at apps/dokploy/server/api/routers/organization.ts:145
});
}),
update: protectedProcedure
.input(
z.object({
organizationId: z.string(),
name: z.string(),
logo: z.string().optional(),
defaultRole: z.string().min(1).nullable().optional(),
}),
)
.mutation(async ({ ctx, input }) => {
// First, verify the organization exists
const org = await db.query.organization.findFirst({
where: eq(organization.id, input.organizationId),
});
if (!org) {
throw new TRPCError({
code: "NOT_FOUND",
message: "Organization not found",
});
}
// Verify user is a member of this organization
const userMember = await db.query.member.findFirst({
where: and(
eq(member.organizationId, input.organizationId),
eq(member.userId, ctx.user.id),
),
});
if (!userMember) {
throw new TRPCError({
code: "FORBIDDEN",
message: "You are not a member of this organization",
});View on GitHub (pinned to 546686ea35)
Solutions
- List your organizations and confirm the id exists
- Re-fetch the org id in the current environment before updating
- Check for soft-delete/recent deletion in audit logs
- If the org should exist, inspect the organization table directly
Example fix
// before
await trpc.organization.update.mutate({ organizationId: staleId, name: 'X' }); // NOT_FOUND
// after
const org = (await trpc.organization.all.query()).find(o => o.name === 'X');
if (org) await trpc.organization.update.mutate({ organizationId: org.organizationId, name: 'X2' }); Defensive patterns
Strategy: validation
Validate before calling
const exists = (await trpc.organization.all.query()).some(o => o.organizationId === organizationId);
if (!exists) throw new Error('Organization no longer exists'); Type guard
const isUuid = (id: unknown): id is string => typeof id === 'string' && /^[0-9a-f-]{36}$/i.test(id); Try / catch
try { await update(input); } catch (e) { if (getTRPCCode(e) === 'NOT_FOUND') { await refetchOrgs(); showGone(); } else throw e; } Prevention
- Refresh org list before edits
- Disable double-submit
- Never copy org IDs between environments
When it happens
Trigger: Calling organization.update with an organizationId that doesn't exist in the DB — deleted org, stale reference in the UI, or malformed UUID.
Common situations: Org deleted in another tab/session while the settings page was open; environment mismatch (dev id used against prod); UUID truncated when copied; restore-from-backup dropped the row.
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/60db77da0888980b.
Report an issue: GitHub.