Dokploy/dokploy · warning · TRPCError

CONFLICT

CONFLICT

Error message

A DNS provider named "${input.name}" already exists in this organization

What it means

createDnsProvider detects a unique-name violation (isUniqueNameViolation on the caught DB error) and rethrows as CONFLICT, indicating a DNS provider with the same name already exists in the organization. This enforces per-organization name uniqueness for DNS providers.

Source

Thrown at packages/server/src/services/dns-provider.ts:82

			.values({
				name: input.name,
				providerType: input.config.providerType,
				config: input.config,
				organizationId,
			})
			.returning()
			.then((value) => value[0]);

		if (!newProvider) {
			throw new TRPCError({
				code: "BAD_REQUEST",
				message: "Error creating the DNS provider",
			});
		}
		return newProvider;
	} catch (error) {
		if (isUniqueNameViolation(error)) {
			throw new TRPCError({
				code: "CONFLICT",
				message: `A DNS provider named "${input.name}" already exists in this organization`,
			});
		}
		throw error;
	}
};

export const findDnsProviderById = async (dnsProviderId: string) => {
	const provider = await db.query.dnsProvider.findFirst({
		where: eq(dnsProvider.dnsProviderId, dnsProviderId),
	});
	if (!provider) {
		throw new TRPCError({
			code: "NOT_FOUND",
			message: "DNS provider not found",
		});
	}

View on GitHub (pinned to 546686ea35)

Solutions

  1. Choose a different, unique name for the provider within the organization
  2. List existing DNS providers first and reuse/update the existing one instead of creating a duplicate
  3. Disable the submit button / dedupe retries in the client
  4. If the row was actually created on a prior attempt, delete or rename the old one

Example fix

// before
await createDnsProvider({ name: "cloudflare", ... });
// after: check for existing provider first
const existing = providers.find((p) => p.name === "cloudflare");
if (existing) await updateDnsProvider(existing.dnsProviderId, {...});
else await createDnsProvider({ name: "cloudflare", ... });
Defensive patterns

Strategy: validation

Validate before calling

const dupe = providers.some((p) => p.name === input.name);
if (dupe) throw new Error("Name already used in this organization");

Try / catch

try { await createDnsProvider(input); } catch (e) { if (e instanceof TRPCError && e.code === "CONFLICT") { /* prompt for a new name */ } throw e; }

Prevention

When it happens

Trigger: POSTing a new DNS provider with a name that already exists within the same organization (e.g. two providers named "Cloudflare prod").

Common situations: Double-submitting the create form; retrying after a network error without realizing the first attempt succeeded; picking default names like the provider type that collide.

Related errors


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