{"record":{"id":"3d01784f5a4f69b3","repo":"Dokploy/dokploy","slug":"internal-server-error-3d0178","errorCode":"INTERNAL_SERVER_ERROR","errorMessage":"Error fetching tags: ${error instanceof Error ? error.message : error}","messagePattern":"Error fetching tags: (.+?)","errorType":"exception","errorClass":"TRPCError","httpStatus":500,"severity":"error","filePath":"apps/dokploy/server/api/routers/tag.ts","lineNumber":59,"sourceCode":"\t\t\t\t}\n\t\t\t\tthrow new TRPCError({\n\t\t\t\t\tcode: \"BAD_REQUEST\",\n\t\t\t\t\tmessage: `Error creating tag: ${error instanceof Error ? error.message : error}`,\n\t\t\t\t\tcause: error,\n\t\t\t\t});\n\t\t\t}\n\t\t}),\n\n\tall: protectedProcedure.query(async ({ ctx }) => {\n\t\ttry {\n\t\t\tconst organizationTags = await db.query.tags.findMany({\n\t\t\t\twhere: eq(tags.organizationId, ctx.session.activeOrganizationId),\n\t\t\t\torderBy: (tags, { asc }) => [asc(tags.name)],\n\t\t\t});\n\n\t\t\treturn organizationTags;\n\t\t} catch (error) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: \"INTERNAL_SERVER_ERROR\",\n\t\t\t\tmessage: `Error fetching tags: ${error instanceof Error ? error.message : error}`,\n\t\t\t\tcause: error,\n\t\t\t});\n\t\t}\n\t}),\n\n\tone: protectedProcedure.input(apiFindOneTag).query(async ({ input, ctx }) => {\n\t\ttry {\n\t\t\tconst tag = await db.query.tags.findFirst({\n\t\t\t\twhere: and(\n\t\t\t\t\teq(tags.tagId, input.tagId),\n\t\t\t\t\teq(tags.organizationId, ctx.session.activeOrganizationId),\n\t\t\t\t),\n\t\t\t});\n\n\t\t\tif (!tag) {\n\t\t\t\tthrow new TRPCError({","sourceCodeStart":41,"sourceCodeEnd":77,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/routers/tag.ts#L41-L77","documentation":"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.","triggerScenarios":"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.","commonSituations":"Postgres restart or pool exhaustion; migration skipped so tags table schema is old; corrupted session with missing activeOrganizationId; disk full on the DB host.","solutions":["Inspect error.message for the Postgres error code (e.g. 42P01 undefined_table, 08006 connection failure)","Apply pending migrations so the schema matches the app version","Check DB health/credentials and restart the app if the pool is wedged","If activeOrganizationId is null, log out/in to refresh the session"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if (!session.activeOrganizationId) throw new Error('No active organization');\nconst tags = await api.tag.list();","typeGuard":null,"tryCatchPattern":"try { await api.tag.list(); }\ncatch (e) {\n  if (e.shape?.data?.code === 'INTERNAL_SERVER_ERROR' && isTransientDb(e.message))\n    await backoffRetry(() => api.tag.list(), 3);\n  else throw e;\n}","preventionTips":["Keep Postgres healthy and pooled appropriately","Run migrations promptly","Treat read-path 500s as retryable only after confirming transient cause"],"tags":["tag","database","drizzle","fetch","trpc"],"backgroundTag":"database-query-failed","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}