{"record":{"id":"b67a1a7a31e8ed54","repo":"Dokploy/dokploy","slug":"not-found-b67a1a","errorCode":"NOT_FOUND","errorMessage":"Tag not found","messagePattern":"Tag not found","errorType":"exception","errorClass":"TRPCError","httpStatus":404,"severity":"warning","filePath":"apps/dokploy/server/api/routers/tag.ts","lineNumber":77,"sourceCode":"\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({\n\t\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\t\tmessage: \"Tag not found\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\treturn tag;\n\t\t} catch (error) {\n\t\t\tif (error instanceof TRPCError) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: \"INTERNAL_SERVER_ERROR\",\n\t\t\t\tmessage: `Error fetching tag: ${error instanceof Error ? error.message : error}`,\n\t\t\t\tcause: error,\n\t\t\t});\n\t\t}\n\t}),\n","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/routers/tag.ts#L59-L95","documentation":"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.","triggerScenarios":"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.","commonSituations":"Stale UI after another admin deleted the tag; wrong active organization selected; deep link with an outdated tagId after re-creating tags.","solutions":["Refresh the tag list and use a current tagId from your active organization","Switch the active organization if the tag lives in another org you own","Handle 404 gracefully by removing the tag from local state"],"exampleFix":"// before\nconst tag = await api.tag.get({ tagId });\n// after\nconst tags = await api.tag.list();\nconst tag = tags.find(t => t.tagId === tagId) ?? null;\nif (tag) await api.tag.get({ tagId }); // or just use the list result","handlingStrategy":"try-catch","validationCode":"const tags = await api.tag.list();\nconst exists = tags.some(t => t.tagId === tagId);\nif (exists) await api.tag.get({ tagId });","typeGuard":null,"tryCatchPattern":"try { return await api.tag.get({ tagId }); }\ncatch (e) { if (e.shape?.data?.code === 'NOT_FOUND') return null; throw e; }","preventionTips":["Resolve tagIds from a freshly fetched list","Drop 404'd tags from local caches","Remember cross-org ids also 404 by design"],"tags":["tag","not-found","multi-tenant","trpc"],"backgroundTag":"resource-not-found","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}