Dokploy/dokploy · warning · TRPCError

CONFLICT

CONFLICT

Error message

Service with this 'AppName' already exists

What it means

Thrown by createLibsql when validUniqueServerAppName reports the chosen appName is already in use. Dokploy prefixes it ('libsql-<name>') and enforces globally unique app names per server, so this is a duplicate-key business-rule check mapped to HTTP 409 CONFLICT.

Source

Thrown at packages/server/src/services/libsql.ts:25

} from "@dokploy/server/db/schema";
import { generatePassword } from "@dokploy/server/templates";
import { buildLibsql } from "@dokploy/server/utils/databases/libsql";
import { pullImage } from "@dokploy/server/utils/docker/utils";
import { execAsyncRemote } from "@dokploy/server/utils/process/execAsync";
import { TRPCError } from "@trpc/server";
import { eq, getTableColumns } from "drizzle-orm";
import { quote } from "shell-quote";
import type { z } from "zod";
import { validUniqueServerAppName } from "./project";

export type Libsql = typeof libsql.$inferSelect;

export const createLibsql = async (input: z.infer<typeof apiCreateLibsql>) => {
	const appName = buildAppName("libsql", input.appName);

	const valid = await validUniqueServerAppName(input.appName);
	if (!valid) {
		throw new TRPCError({
			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) {

View on GitHub (pinned to 546686ea35)

Solutions

  1. Choose a different, more specific appName and retry
  2. List existing apps (admin/apps endpoint) to see which name is taken
  3. If the old service was supposed to be deleted, remove its row so the name frees up

Example fix

// before
await createLibsql({ appName: 'main' }); // 409 if 'libsql-main' exists

// after
await createLibsql({ appName: 'main-prod-2026' });
Defensive patterns

Strategy: validation

Validate before calling

const apps = await trpc.admin.listApps.query();
const nameTaken = apps.some(a => a.name === `libsql-${input.appName}`);
if (nameTaken) throw new Error('AppName taken');

Try / catch

try { await createLibsql(input); } catch (e) { if (e.shape?.data?.code === 'CONFLICT') { input.appName = `${input.appName}-${Date.now()}`; await createLibsql(input); } }

Prevention

When it happens

Trigger: Calling createLibsql with an appName that collides with an existing application/service name on the server (after the 'libsql-' prefix is applied by buildAppName).

Common situations: Re-running a setup script that recreates the same database, choosing a generic name like 'db' or 'main', or deleting an app in the UI while its name is still reserved in the database.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/b98f852eeb8ac827. Report an issue: GitHub.