{"record":{"id":"fd13d18b65947b8f","repo":"Dokploy/dokploy","slug":"unauthorized-fd13d1","errorCode":"UNAUTHORIZED","errorMessage":"You don't have access to this project","messagePattern":"You don't have access to this project","errorType":"exception","errorClass":"TRPCError","httpStatus":401,"severity":"error","filePath":"apps/dokploy/server/api/routers/project.ts","lineNumber":119,"sourceCode":"\t\t\t\tthrow new TRPCError({\n\t\t\t\t\tcode: \"BAD_REQUEST\",\n\t\t\t\t\tmessage: `Error creating the project: ${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\tone: protectedProcedure\n\t\t.input(apiFindOneProject)\n\t\t.query(async ({ input, ctx }) => {\n\t\t\tif (ctx.user.role !== \"owner\" && ctx.user.role !== \"admin\") {\n\t\t\t\tconst { accessedServices, accessedProjects } = await findMemberByUserId(\n\t\t\t\t\tctx.user.id,\n\t\t\t\t\tctx.session.activeOrganizationId,\n\t\t\t\t);\n\n\t\t\t\tif (!accessedProjects.includes(input.projectId)) {\n\t\t\t\t\tthrow new TRPCError({\n\t\t\t\t\t\tcode: \"UNAUTHORIZED\",\n\t\t\t\t\t\tmessage: \"You don't have access to this project\",\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tconst project = await db.query.projects.findFirst({\n\t\t\t\t\twhere: and(\n\t\t\t\t\t\teq(projects.projectId, input.projectId),\n\t\t\t\t\t\teq(projects.organizationId, ctx.session.activeOrganizationId),\n\t\t\t\t\t),\n\t\t\t\t\twith: {\n\t\t\t\t\t\tenvironments: {\n\t\t\t\t\t\t\twith: {\n\t\t\t\t\t\t\t\tapplications: {\n\t\t\t\t\t\t\t\t\tcolumns: {\n\t\t\t\t\t\t\t\t\t\t...serviceColumns,\n\t\t\t\t\t\t\t\t\t\tapplicationId: true,\n\t\t\t\t\t\t\t\t\t\ticon: true,","sourceCodeStart":101,"sourceCodeEnd":137,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/routers/project.ts#L101-L137","documentation":"For non-admin users, Dokploy checks the member's accessedProjects list (from findMemberByUserId) before reading a project. If the projectId isn't in the member's per-project grants, access is denied even within the same organization.","triggerScenarios":"A member-level user (not owner/admin) requests a project they weren't explicitly granted; project access was revoked; member record not yet updated after new project creation.","commonSituations":"Restricted members opening shared deep links to non-granted projects; admin creates a project but doesn't assign it to the member.","solutions":["Have an owner/admin grant the member access to that project in the member's project assignments","If you're the admin, use an admin account or fix the member's project list","Re-fetch the member's accessible projects and navigate only via those"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const { accessedProjects } = await api.member.byUserId.query();\nif (!accessedProjects.includes(projectId)) throw new Error('No grant for this project');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Members should navigate only via projects listed for them","Admins: assign new projects to members who need them"],"tags":["dokploy","authorization","project","member-permissions"],"backgroundTag":"resource-access-denied","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}