Dokploy/dokploy · error · TRPCError

BAD_REQUEST

BAD_REQUEST

Error message

Error input:  Inserting registry

What it means

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.

Source

Thrown at packages/server/src/services/registry.ts:55

	return message.split(password).join("***");
}

export const createRegistry = async (
	input: z.infer<typeof apiCreateRegistry>,
	organizationId: string,
) => {
	return await db.transaction(async (tx) => {
		const newRegistry = await tx
			.insert(registry)
			.values({
				...input,
				organizationId: organizationId,
			})
			.returning()
			.then((value) => value[0]);

		if (!newRegistry) {
			throw new TRPCError({
				code: "BAD_REQUEST",
				message: "Error input:  Inserting registry",
			});
		}

		if (IS_CLOUD && !input.serverId && input.serverId !== "none") {
			throw new TRPCError({
				code: "NOT_FOUND",
				message: "Select a server to add the registry",
			});
		}
		const loginCommand = safeDockerLoginCommand(
			input.registryUrl,
			input.username,
			input.password,
		);
		try {
			if (input.serverId && input.serverId !== "none") {

View on GitHub (pinned to 546686ea35)

Solutions

  1. Check server logs for the drizzle/postgres error preceding this throw
  2. Run pending migrations so the registry table matches the current drizzle schema
  3. Validate the create-registry payload includes registryUrl, username, password, registryType, etc.
  4. Log the values object before tx.insert(registry) to spot undefined required fields
Defensive patterns

Strategy: validation

Validate before calling

const parsed = apiCreateRegistry.safeParse(input);
if (!parsed.success) throw new Error(parsed.error.message);

Try / catch

try { await createRegistry(input, orgId); } catch (e) { if (e instanceof TRPCError && /Inserting registry/.test(e.message)) { /* check migrations + payload */ } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: BAD_REQUEST error code: request rejected as invalid (HTTP 400) - causes and fixes across libraries — this error's family across 8 libraries.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/1564b84424f9f325. Report an issue: GitHub.