Dokploy/dokploy · error · TRPCError
BAD_REQUEST
BAD_REQUEST
Error message
Error creating the notification
What it means
Dokploy wraps notification creation (the Slack create mutation at notification.ts ~line 110-125) in a try/catch that converts any underlying failure — invalid webhook URL, DB constraint, mailer config — into a tRPC BAD_REQUEST with the generic message 'Error creating the notification' and the original error attached as cause.
Source
Thrown at apps/dokploy/server/api/routers/notification.ts:122
resourceType: "notification",
resourceName: input.name,
});
} catch (error) {
console.log(error);
throw new TRPCError({
code: "BAD_REQUEST",
message: "Error creating the notification",
cause: error,
});
}
}),
updateSlack: withPermission("notification", "update")
.input(apiUpdateSlack)
.mutation(async ({ input, ctx }) => {
try {
const notification = await findNotificationById(input.notificationId);
if (notification.organizationId !== ctx.session.activeOrganizationId) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You are not authorized to update this notification",
});
}
const result = await updateSlackNotification({
...input,
organizationId: ctx.session.activeOrganizationId,
});
await audit(ctx, {
action: "update",
resourceType: "notification",
resourceId: input.notificationId,
resourceName: notification.name,
});
return result;
} catch (error) {
throw error;
}View on GitHub (pinned to 546686ea35)
Solutions
- Inspect error.cause on the TRPCError — the original rejection explains the real failure
- Validate the Slack webhook URL format (https://hooks.slack.com/services/...) before submitting
- Check required input fields against apiCreateSlack (zod) and fix validation errors surfaced client-side
- Check server logs/DB health if cause is a database error
Example fix
// before
await trpc.notification.createSlack.mutate(input);
// after
if (!/^https:\/\/hooks\.slack\.com\/services\//.test(input.webhookUrl)) {
throw new Error('Invalid Slack webhook URL');
}
await trpc.notification.createSlack.mutate(input).catch(e => { console.error(e.cause ?? e); throw e; }); Defensive patterns
Strategy: try-catch
Validate before calling
if (!input.webhookUrl?.startsWith('https://hooks.slack.com/services/')) throw new Error('Invalid webhook'); Type guard
const isSlackWebhook = (u: string) => /^https:\/\/hooks\.slack\.com\/services\/[\w-/.]+$/.test(u);
Try / catch
try { await create(input); } catch (e) { logAndShow(e.cause ?? e); } Prevention
- Validate webhook URLs client-side before submit
- Never ignore error.cause — it carries the real failure
When it happens
Trigger: Calling notification.createSlack (the mutation whose audit block has action "create") when createSlackNotification or the audit call rejects: malformed Slack webhook URL, missing required fields, or a database error.
Common situations: Invalid/partially configured Slack webhook (wrong workspace or truncated URL); duplicate notification names hitting a uniqueness constraint; DB connectivity issues during creation.
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/27c0fa7b111d7c80.
Report an issue: GitHub.