Dokploy/dokploy · error · TRPCError

CONFLICT

CONFLICT

Error message

Service with this 'AppName' already exists

What it means

createRedis builds an app name via buildAppName('redis', input.appName) and checks uniqueness with validUniqueServerAppName across the target server. If the generated AppName is already taken, CONFLICT is returned: each service on a server must have a unique app name.

Source

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

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

export type Redis = typeof redis.$inferSelect;

// https://github.com/drizzle-team/drizzle-orm/discussions/1483#discussioncomment-7523881
export const createRedis = async (input: z.infer<typeof apiCreateRedis>) => {
	const appName = buildAppName("redis", input.appName);

	const valid = await validUniqueServerAppName(appName);
	if (!valid) {
		throw new TRPCError({
			code: "CONFLICT",
			message: "Service with this 'AppName' already exists",
		});
	}

	const newRedis = await db
		.insert(redis)
		.values({
			...input,
			databasePassword: input.databasePassword
				? input.databasePassword
				: generatePassword(),
			appName,
		})
		.returning()
		.then((value) => value[0]);

	if (!newRedis) {

View on GitHub (pinned to 546686ea35)

Solutions

  1. Choose a different appName for the new redis service
  2. List existing services on the server and remove/rename the conflicting one
  3. If the old service was deleted but the name is still reserved, check for orphaned records

Example fix

// before
await createRedis({ appName: 'cache', ... });
// after
await createRedis({ appName: 'cache-2', ... });
Defensive patterns

Strategy: validation

Validate before calling

const appName = buildAppName('redis', input.appName);
const unique = await validUniqueServerAppName(appName);
if (!unique) { /* pick another appName before creating */ }

Try / catch

try { await createRedis(input) } catch (e) { if (e instanceof TRPCError && e.code === 'CONFLICT') { /* prompt user for a new appName */ } }

Prevention

When it happens

Trigger: POST createRedis with an appName (or auto-derived name) that collides with an existing redis (or other) service's AppName on the same server.

Common situations: Creating a second redis service with the same custom appName; previous redis deployment with the same name still exists (stopped or soft-deleted); name collisions after recreating services from a template.

Related errors


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