Dokploy/dokploy · error · TRPCError

BAD_REQUEST

BAD_REQUEST

Error message

Error creating the destination

What it means

Catch-all wrapping destination creation: any failure creating the destination record (DB constraints, validation, duplicate names) is rethrown as BAD_REQUEST with the original error attached as cause.

Source

Thrown at apps/dokploy/server/api/routers/destination.ts:41

export const destinationRouter = createTRPCRouter({
	create: withPermission("destination", "create")
		.input(apiCreateDestination)
		.mutation(async ({ input, ctx }) => {
			try {
				const result = await createDestination(
					input,
					ctx.session.activeOrganizationId,
				);
				await audit(ctx, {
					action: "create",
					resourceType: "destination",
					resourceId: result.destinationId,
					resourceName: input.name,
				});
				return result;
			} catch (error) {
				throw new TRPCError({
					code: "BAD_REQUEST",
					message: "Error creating the destination",
					cause: error,
				});
			}
		}),
	testConnection: withPermission("destination", "create")
		.input(apiCreateDestination)
		.mutation(async ({ input }) => {
			const {
				secretAccessKey,
				bucket,
				region,
				endpoint,
				accessKey,
				provider,
				additionalFlags,
			} = input;

View on GitHub (pinned to 546686ea35)

Solutions

  1. Inspect error.cause for the underlying DB error
  2. Use a unique destination name
  3. Verify all required input fields are provided
Defensive patterns

Strategy: try-catch

Try / catch

try { await createDestination(input); } catch (e) { console.error(e.cause); }

Prevention

When it happens

Trigger: Creating a destination with a name that collides with an existing one, invalid input fields, or a database error during insert.

Common situations: Duplicate destination names in the same org; missing required fields; DB connectivity issues.

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