Dokploy/dokploy · error · TRPCError
BAD_REQUEST
BAD_REQUEST
Error message
Server is required
What it means
findNetworksToSync requires an explicit serverId when running the cloud edition (IS_CLOUD). On cloud, docker networks are per-server resources and there is no default/local docker, so serverId: null is rejected as BAD_REQUEST.
Source
Thrown at packages/server/src/services/network.ts:90
const findNetworksByServer = async (
organizationId: string,
serverId: string | null,
) => {
return await db.query.network.findMany({
where: and(
eq(network.organizationId, organizationId),
serverId ? eq(network.serverId, serverId) : isNull(network.serverId),
),
});
};
export const findNetworksToSync = async (
organizationId: string,
serverId: string | null,
) => {
if (IS_CLOUD && !serverId) {
throw new TRPCError({
code: "BAD_REQUEST",
message: "Server is required",
});
}
const docker = await getRemoteDocker(serverId);
let dockerNetworks: DockerNetworkInfo[] = [];
try {
dockerNetworks = (await docker.listNetworks()) as DockerNetworkInfo[];
} catch (error) {
throw new TRPCError({
code: "BAD_REQUEST",
message:
error instanceof Error
? error.message
: "Failed to list Docker networks",
cause: error,
});View on GitHub (pinned to 546686ea35)
Solutions
- Pass a valid serverId in the request
- Ensure the server dropdown/selection is made before triggering network sync
- Set the active server in client context before calling the API
Example fix
// before
await trpc.network.findNetworksToSync.query({ organizationId, serverId: null });
// after
await trpc.network.findNetworksToSync.query({ organizationId, serverId: selectedServerId }); Defensive patterns
Strategy: validation
Validate before calling
if (IS_CLOUD && !serverId) throw new Error("select a server before syncing networks"); Type guard
const hasServer = (s: string | null): s is string => typeof s === "string" && s.length > 0;
Try / catch
try { await findNetworksToSync(orgId, serverId); } catch (e) { if (e instanceof TRPCError && e.message === "Server is required") promptServerSelection(); else throw e; } Prevention
- Gate cloud UI actions on an active server selection
- Centralize a requireServerId() helper in clients
When it happens
Trigger: Calling the network sync endpoint from the cloud UI/API without a server selected — e.g. serverId omitted from the request payload or null passed explicitly.
Common situations: Client built against self-hosted mode (where serverId is optional) deployed against the cloud version; UI state where no server is picked yet.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27).
Data as JSON: /api/errors/ba55ecd26c885c44.
Report an issue: GitHub.