Dokploy/dokploy · error · TRPCError
BAD_REQUEST
BAD_REQUEST
Error message
Error input: Inserting libsql database
What it means
Thrown by createLibsql when the Drizzle insert into the libsql table with .returning() produces no row. Like its sibling BAD_REQUEST insert errors, it means the INSERT itself failed (constraint, schema mismatch, or DB error) — not that user input was malformed validation-wise.
Source
Thrown at packages/server/src/services/libsql.ts:44
code: "CONFLICT",
message: "Service with this 'AppName' already exists",
});
}
const newLibsql = await db
.insert(libsql)
.values({
...input,
databasePassword: input.databasePassword
? input.databasePassword
: generatePassword(),
appName,
})
.returning()
.then((value) => value[0]);
if (!newLibsql) {
throw new TRPCError({
code: "BAD_REQUEST",
message: "Error input: Inserting libsql database",
});
}
return newLibsql;
};
// https://github.com/drizzle-team/drizzle-orm/discussions/1483#discussioncomment-7523881
export const findLibsqlById = async (libsqlId: string) => {
const result = await db.query.libsql.findFirst({
where: eq(libsql.libsqlId, libsqlId),
with: {
environment: {
with: {
project: true,
},
},View on GitHub (pinned to 546686ea35)
Solutions
- Check server logs for the Postgres error accompanying the failed insert
- Run pending migrations / drizzle push so the libsql table matches the schema
- Validate that required fields (appName, applicationStatus) have values before insert
Defensive patterns
Strategy: try-catch
Try / catch
try { const db = await createLibsql(input); } catch (e) { if (e.shape?.data?.code === 'BAD_REQUEST') { logServerError(e); /* DB-side, inspect logs */ } } Prevention
- Keep migrations in sync before creating resources
- Monitor DB connectivity/health
When it happens
Trigger: Calling createLibsql after the duplicate-name check passes, but the INSERT ... RETURNING into the libsql table returns empty — e.g. NOT NULL violation, enum mismatch on applicationStatus, or schema drift.
Common situations: Schema drift after upgrading Dokploy without running migrations, a missing default on a new column, or a DB connection that drops mid-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/664e32127afb8ba7.
Report an issue: GitHub.