Dokploy/dokploy · error · TRPCError
BAD_REQUEST
BAD_REQUEST
Error message
Error creating the project: ${error instanceof Error ? error.message : error} What it means
Catch-all BAD_REQUEST around the whole project.create flow. Any non-TRPCError thrown while creating the project (and its default environment) is rethrown with the original message embedded. Typical causes: DB constraint violations, slug/name collisions, or downstream service failures.
Source
Thrown at apps/dokploy/server/api/routers/project.ts:101
}
const project = await createProject(
input,
ctx.session.activeOrganizationId,
);
await addNewProject(ctx, project.project.projectId);
await addNewEnvironment(ctx, project?.environment?.environmentId || "");
await audit(ctx, {
action: "create",
resourceType: "project",
resourceId: project.project.projectId,
resourceName: project.project.name,
});
return project;
} catch (error) {
throw new TRPCError({
code: "BAD_REQUEST",
message: `Error creating the project: ${error instanceof Error ? error.message : error}`,
cause: error,
});
}
}),
one: protectedProcedure
.input(apiFindOneProject)
.query(async ({ input, ctx }) => {
if (ctx.user.role !== "owner" && ctx.user.role !== "admin") {
const { accessedServices, accessedProjects } = await findMemberByUserId(
ctx.user.id,
ctx.session.activeOrganizationId,
);
if (!accessedProjects.includes(input.projectId)) {
throw new TRPCError({View on GitHub (pinned to 546686ea35)
Solutions
- Read the appended inner message — it names the actual failure
- If it's a name/slug collision, pick a different project name
- Check control-plane database health and run pending migrations
- Retry once transient issues are resolved
Defensive patterns
Strategy: try-catch
Try / catch
try { await api.project.create.mutate(input); }
catch (e) { report(e.message.replace(/^Error creating the project: /, '')); } Prevention
- Surface the embedded inner message to users
- Avoid duplicate project names to dodge constraint errors
When it happens
Trigger: Any unexpected exception during createProject — duplicate project name constraint, database errors, or (in cloud) provisioning failures. The inner error message is appended to the message string.
Common situations: Creating many projects rapidly hitting a unique constraint; DB schema drift after upgrade; control-plane DB briefly down.
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/819d5a39512f8f23.
Report an issue: GitHub.