Dokploy/dokploy · warning · TRPCError

NOT_FOUND

NOT_FOUND

Error message

Tag not found

What it means

Thrown by tag.get when no tag row matches both tagId and the caller's activeOrganizationId. The organization scoping means a valid tag id from another org also returns NOT_FOUND (rather than UNAUTHORIZED), preventing existence leaks.

Source

Thrown at apps/dokploy/server/api/routers/tag.ts:77

			throw new TRPCError({
				code: "INTERNAL_SERVER_ERROR",
				message: `Error fetching tags: ${error instanceof Error ? error.message : error}`,
				cause: error,
			});
		}
	}),

	one: protectedProcedure.input(apiFindOneTag).query(async ({ input, ctx }) => {
		try {
			const tag = await db.query.tags.findFirst({
				where: and(
					eq(tags.tagId, input.tagId),
					eq(tags.organizationId, ctx.session.activeOrganizationId),
				),
			});

			if (!tag) {
				throw new TRPCError({
					code: "NOT_FOUND",
					message: "Tag not found",
				});
			}

			return tag;
		} catch (error) {
			if (error instanceof TRPCError) {
				throw error;
			}
			throw new TRPCError({
				code: "INTERNAL_SERVER_ERROR",
				message: `Error fetching tag: ${error instanceof Error ? error.message : error}`,
				cause: error,
			});
		}
	}),

View on GitHub (pinned to 546686ea35)

Solutions

  1. Refresh the tag list and use a current tagId from your active organization
  2. Switch the active organization if the tag lives in another org you own
  3. Handle 404 gracefully by removing the tag from local state

Example fix

// before
const tag = await api.tag.get({ tagId });
// after
const tags = await api.tag.list();
const tag = tags.find(t => t.tagId === tagId) ?? null;
if (tag) await api.tag.get({ tagId }); // or just use the list result
Defensive patterns

Strategy: try-catch

Validate before calling

const tags = await api.tag.list();
const exists = tags.some(t => t.tagId === tagId);
if (exists) await api.tag.get({ tagId });

Try / catch

try { return await api.tag.get({ tagId }); }
catch (e) { if (e.shape?.data?.code === 'NOT_FOUND') return null; throw e; }

Prevention

When it happens

Trigger: Calling tag.get({ tagId }) where the tag was deleted, the id is wrong/copied from another org, or the session's active organization differs from the org that owns the tag.

Common situations: Stale UI after another admin deleted the tag; wrong active organization selected; deep link with an outdated tagId after re-creating tags.

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