{"record":{"id":"5324f27788f34c1c","repo":"Dokploy/dokploy","slug":"not-found-5324f2","errorCode":"NOT_FOUND","errorMessage":"Select a server to add the registry","messagePattern":"Select a server to add the registry","errorType":"exception","errorClass":"TRPCError","httpStatus":404,"severity":"error","filePath":"packages/server/src/services/registry.ts","lineNumber":62,"sourceCode":"\treturn await db.transaction(async (tx) => {\n\t\tconst newRegistry = await tx\n\t\t\t.insert(registry)\n\t\t\t.values({\n\t\t\t\t...input,\n\t\t\t\torganizationId: organizationId,\n\t\t\t})\n\t\t\t.returning()\n\t\t\t.then((value) => value[0]);\n\n\t\tif (!newRegistry) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: \"BAD_REQUEST\",\n\t\t\t\tmessage: \"Error input:  Inserting registry\",\n\t\t\t});\n\t\t}\n\n\t\tif (IS_CLOUD && !input.serverId && input.serverId !== \"none\") {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: \"NOT_FOUND\",\n\t\t\t\tmessage: \"Select a server to add the registry\",\n\t\t\t});\n\t\t}\n\t\tconst loginCommand = safeDockerLoginCommand(\n\t\t\tinput.registryUrl,\n\t\t\tinput.username,\n\t\t\tinput.password,\n\t\t);\n\t\ttry {\n\t\t\tif (input.serverId && input.serverId !== \"none\") {\n\t\t\t\tawait execAsyncRemote(input.serverId, loginCommand);\n\t\t\t} else if (newRegistry.registryType === \"cloud\") {\n\t\t\t\tawait execAsync(loginCommand);\n\t\t\t}\n\t\t} catch (error) {\n\t\t\tconst sanitized = sanitizeRegistryError(error, input.password);\n\t\t\tthrow new TRPCError({ code: \"BAD_REQUEST\", message: sanitized });","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/registry.ts#L44-L80","documentation":"In createRegistry, when running Dokploy Cloud (IS_CLOUD) and the request omits serverId (or it is undefined while not being the literal 'none'), a NOT_FOUND error 'Select a server to add the registry' is thrown before the docker login is attempted. Self-hosted (non-cloud) instances skip this check entirely.","triggerScenarios":"On Dokploy Cloud, POSTing a new registry without a serverId field, or with serverId: null/undefined, while expecting the login to run on a specific server. The condition is only false when serverId is 'none' (local execution) or a real server ID.","commonSituations":"Cloud users building API integrations that worked against self-hosted Dokploy (where serverId is optional); UI form not sending the selected server after a refactor; passing empty string instead of 'none'.","solutions":["Send a valid serverId of a connected server in the create-registry request","Send the literal string 'none' if the login should run on the main Dokploy server (cloud self server)","If self-hosting is an option, note this check does not apply when IS_CLOUD is false"],"exampleFix":"// before\nawait trpc.registry.create.mutate({ registryUrl, username, password, registryType: \"cloud\" });\n\n// after\nawait trpc.registry.create.mutate({ registryUrl, username, password, registryType: \"cloud\", serverId: \"none\" });","handlingStrategy":"validation","validationCode":"if (IS_CLOUD && !input.serverId) input.serverId = \"none\"; // or a real server ID from the servers list","typeGuard":"const hasServerSelection = (v: unknown): v is { serverId: string } =>\n  typeof v === \"object\" && v !== null && typeof (v as any).serverId === \"string\" && (v as any).serverId !== \"\";","tryCatchPattern":"null","preventionTips":["On cloud, always send serverId ('none' or a real ID) for registry create/update","Build API payloads from the same shape the UI sends"],"tags":["dokploy","registry","cloud","server-selection","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}