Dokploy/dokploy · error · TRPCError

BAD_REQUEST

BAD_REQUEST

Error message

Error input: Inserting slack

What it means

Inside a transaction, createSlackNotification inserts into the slack table with .returning(); if no row comes back it throws BAD_REQUEST 'Error input: Inserting slack', which aborts the tx (the companion notification destination insert never runs).

Source

Thrown at packages/server/src/services/notification.ts:62

export type Notification = typeof notifications.$inferSelect;

export const createSlackNotification = async (
	input: z.infer<typeof apiCreateSlack>,
	organizationId: string,
) => {
	await db.transaction(async (tx) => {
		const newSlack = await tx
			.insert(slack)
			.values({
				channel: input.channel,
				webhookUrl: input.webhookUrl,
			})
			.returning()
			.then((value) => value[0]);

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

		const newDestination = await tx
			.insert(notifications)
			.values({
				slackId: newSlack.slackId,
				name: input.name,
				appDeploy: input.appDeploy,
				appBuildError: input.appBuildError,
				databaseBackup: input.databaseBackup,
				dokployBackup: input.dokployBackup,
				volumeBackup: input.volumeBackup,
				dokployRestart: input.dokployRestart,
				dockerCleanup: input.dockerCleanup,
				notificationType: "slack",

View on GitHub (pinned to 546686ea35)

Solutions

  1. Apply/verify migrations for the slack table
  2. Check DB logs for the aborted INSERT
  3. Retry — transient failures commonly surface here
  4. Validate the DB connection supports RETURNING (avoid transaction-mode poolers for DDL-ish flows)
Defensive patterns

Strategy: retry

Try / catch

try { await createSlackNotification(input); } catch (e) { if (e instanceof TRPCError && e.message.includes("Inserting slack")) await backoffRetry(2); else throw e; }

Prevention

When it happens

Trigger: DB driver/connection failure mid-transaction, schema drift on the slack table, or a pooler that mishandles RETURNING inside transactions.

Common situations: Migrations not applied (missing slack table/columns), pgbouncer transaction-pooling quirks, transient connection resets.

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/7545e18eb660fd3f. Report an issue: GitHub.