Dokploy/dokploy · error · TRPCError

INTERNAL_SERVER_ERROR

INTERNAL_SERVER_ERROR

Error message

Error fetching tags: ${error instanceof Error ? error.message : error}

What it means

Catch-all in tag.list: fetching tags for the active organization failed at the Drizzle/Postgres layer, and the raw error message is wrapped in INTERNAL_SERVER_ERROR. The query filters tags by organizationId and orders by name, so failures are infrastructure or schema related, not user input.

Source

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

				}
				throw new TRPCError({
					code: "BAD_REQUEST",
					message: `Error creating tag: ${error instanceof Error ? error.message : error}`,
					cause: error,
				});
			}
		}),

	all: protectedProcedure.query(async ({ ctx }) => {
		try {
			const organizationTags = await db.query.tags.findMany({
				where: eq(tags.organizationId, ctx.session.activeOrganizationId),
				orderBy: (tags, { asc }) => [asc(tags.name)],
			});

			return organizationTags;
		} catch (error) {
			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({

View on GitHub (pinned to 546686ea35)

Solutions

  1. Inspect error.message for the Postgres error code (e.g. 42P01 undefined_table, 08006 connection failure)
  2. Apply pending migrations so the schema matches the app version
  3. Check DB health/credentials and restart the app if the pool is wedged
  4. If activeOrganizationId is null, log out/in to refresh the session
Defensive patterns

Strategy: retry

Validate before calling

if (!session.activeOrganizationId) throw new Error('No active organization');
const tags = await api.tag.list();

Try / catch

try { await api.tag.list(); }
catch (e) {
  if (e.shape?.data?.code === 'INTERNAL_SERVER_ERROR' && isTransientDb(e.message))
    await backoffRetry(() => api.tag.list(), 3);
  else throw e;
}

Prevention

When it happens

Trigger: The select on tags where organizationId = session.activeOrganizationId failing — DB connection dropped, tags table missing a column after schema drift, or the session containing a null/invalid activeOrganizationId.

Common situations: Postgres restart or pool exhaustion; migration skipped so tags table schema is old; corrupted session with missing activeOrganizationId; disk full on the DB host.

Related errors


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