Dokploy/dokploy · error · TRPCError
UNAUTHORIZED
UNAUTHORIZED
Error message
You don't have access to this server.
What it means
Ownership check in deployment.allByServer: the server referenced by serverId must belong to the session's active organization or the query is rejected.
Source
Thrown at apps/dokploy/server/api/routers/deployment.ts:60
deployment: ["read"],
});
return await findAllDeploymentsByApplicationId(input.applicationId);
}),
allByCompose: protectedProcedure
.input(apiFindAllByCompose)
.query(async ({ input, ctx }) => {
await checkServicePermissionAndAccess(ctx, input.composeId, {
deployment: ["read"],
});
return await findAllDeploymentsByComposeId(input.composeId);
}),
allByServer: withPermission("deployment", "read")
.input(apiFindAllByServer)
.query(async ({ input, ctx }) => {
const targetServer = await findServerById(input.serverId);
if (targetServer.organizationId !== ctx.session.activeOrganizationId) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You don't have access to this server.",
});
}
return await findAllDeploymentsByServerId(input.serverId);
}),
allCentralized: withPermission("deployment", "read").query(
async ({ ctx }) => {
const orgId = ctx.session.activeOrganizationId;
const accessedServices =
ctx.user.role !== "owner" && ctx.user.role !== "admin"
? (await findMemberByUserId(ctx.user.id, orgId)).accessedServices
: null;
if (accessedServices !== null && accessedServices.length === 0) {
return [];
}
return findAllDeploymentsCentralized(orgId, accessedServices);
},View on GitHub (pinned to 546686ea35)
Solutions
- Use a serverId from the current organization's server list
- Refetch servers after org or membership changes
- Confirm the server exists and is org-owned
Defensive patterns
Strategy: validation
Validate before calling
const s = await findServerById(serverId);
if (s.organizationId !== activeOrgId) throw new Error('Wrong org'); Prevention
- Use only servers listed for the active organization
- Refresh server list after membership changes
When it happens
Trigger: Querying deployments with a serverId from another organization or a stale/rotated server record.
Common situations: Multi-org workspaces; deleted servers still referenced by cached client state; copy-pasted server IDs.
Related errors
AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27).
Data as JSON: /api/errors/39d42b7cb954789a.
Report an issue: GitHub.