Dokploy/dokploy · error · TRPCError
UNAUTHORIZED
UNAUTHORIZED
Error message
You don't have access to this server.
What it means
Cluster swarmpool route guard: when a serverId is provided, the target server's organizationId must match the session's activeOrganizationId before a remote Docker client is created. Thrown during read queries that inspect the swarm/node pool.
Source
Thrown at apps/dokploy/server/api/routers/cluster.ts:26
import { TRPCError } from "@trpc/server";
import { quote } from "shell-quote";
import { z } from "zod";
import { audit } from "@/server/api/utils/audit";
import { getLocalServerIp } from "@/server/wss/terminal";
import { createTRPCRouter, withPermission } from "../trpc";
export const clusterRouter = createTRPCRouter({
getNodes: withPermission("docker", "read")
.input(
z.object({
serverId: z.string().optional(),
}),
)
.query(async ({ input, ctx }) => {
if (input.serverId) {
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.",
});
}
}
const docker = await getRemoteDocker(input.serverId);
const workers: DockerNode[] = await docker.listNodes();
return workers;
}),
removeWorker: withPermission("server", "delete")
.input(
z.object({
nodeId: z.string(),
serverId: z.string().optional(),
}),
)
.mutation(async ({ input, ctx }) => {View on GitHub (pinned to 546686ea35)
Solutions
- Verify the serverId belongs to your active organization (list servers first)
- Switch active organization to the one that owns the server
- Refresh server list to pick a currently-valid serverId
Defensive patterns
Strategy: validation
Validate before calling
const servers = await trpc.server.all.query();
if (input.serverId && !servers.some(s => s.serverId === input.serverId)) {
delete input.serverId; // or throw
} Prevention
- Strip stale serverId query params on org switch
- Populate server selectors from the live API, not localStorage
- Omit serverId when targeting the local web server
When it happens
Trigger: Querying cluster endpoints with a serverId owned by another organization, or using a stale serverId after the server was reassigned/recreated in a different org.
Common situations: Multi-org installs, stale dropdown selection after switching orgs, or scripts with hardcoded serverIds.
Related errors
AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27).
Data as JSON: /api/errors/f6c4bdba91fd5bf5.
Report an issue: GitHub.