{"record":{"id":"1564b84424f9f325","repo":"Dokploy/dokploy","slug":"bad-request-1564b8","errorCode":"BAD_REQUEST","errorMessage":"Error input:  Inserting registry","messagePattern":"Error input:  Inserting registry","errorType":"exception","errorClass":"TRPCError","httpStatus":400,"severity":"error","filePath":"packages/server/src/services/registry.ts","lineNumber":55,"sourceCode":"\treturn message.split(password).join(\"***\");\n}\n\nexport const createRegistry = async (\n\tinput: z.infer<typeof apiCreateRegistry>,\n\torganizationId: string,\n) => {\n\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\") {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/registry.ts#L37-L73","documentation":"Inside createRegistry's db.transaction, the insert into `registry` with .returning() produced no first row, so a BAD_REQUEST TRPCError 'Error input:  Inserting registry' is thrown (note the double space in the message). Because this happens inside a transaction, the whole transaction rolls back.","triggerScenarios":"Calling the registry.create mutation where the input object fails to produce valid column values, the postgres table is out of sync with the drizzle schema, or a NOT NULL column without a default is missing from the values.","commonSituations":"Schema migration drift (registry table missing new columns like buildType/registryType), zod schema allowing empty input through, or a manual DB modification breaking the insert.","solutions":["Check server logs for the drizzle/postgres error preceding this throw","Run pending migrations so the registry table matches the current drizzle schema","Validate the create-registry payload includes registryUrl, username, password, registryType, etc.","Log the values object before tx.insert(registry) to spot undefined required fields"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const parsed = apiCreateRegistry.safeParse(input);\nif (!parsed.success) throw new Error(parsed.error.message);","typeGuard":null,"tryCatchPattern":"try { await createRegistry(input, orgId); } catch (e) { if (e instanceof TRPCError && /Inserting registry/.test(e.message)) { /* check migrations + payload */ } throw e; }","preventionTips":["Run migrations after upgrading Dokploy","Include all required registry fields in the payload"],"tags":["dokploy","registry","drizzle","database-insert","transaction"],"backgroundTag":"database-insert-failed","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}