Dokploy/dokploy · warning · TRPCError

CONFLICT

CONFLICT

Error message

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

What it means

The database raised a unique-constraint violation (detected via isUniqueNameViolation) while inserting a vault provider, meaning another provider in the same organization already uses the requested name. Vault provider names are unique per organization, so the insert is rejected and rethrown as a CONFLICT.

Source

Thrown at packages/server/src/services/vault-provider.ts:124

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

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

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

View on GitHub (pinned to 546686ea35)

Solutions

  1. List existing providers for the organization and pick a different name
  2. Handle 409 CONFLICT in the UI by prompting for a new name instead of retrying blindly
  3. Add idempotency: check for an existing provider with that name before inserting (or reuse it)
  4. Debounce/disable the submit button to prevent double-submits

Example fix

// before
await createVaultProvider({ name: "prod-vault", ... });

// after
const existing = await db.query.vaultProvider.findFirst({
  where: and(eq(vaultProvider.name, input.name), eq(vaultProvider.organizationId, organizationId)),
});
if (existing) return existing; // idempotent reuse
await createVaultProvider({ name: "prod-vault-2", ... });
Defensive patterns

Strategy: validation

Validate before calling

const existing = await db.query.vaultProvider.findFirst({ where: and(eq(vaultProvider.name, input.name), eq(vaultProvider.organizationId, orgId)) });
if (existing) return existing;

Type guard

const isConflictError = (e: unknown): boolean => e instanceof TRPCError && e.code === 'CONFLICT';

Try / catch

try { await createVaultProvider(input); } catch (e) { if (e instanceof TRPCError && e.code === 'CONFLICT') { promptUserForNewName(input.name); return; } throw e; }

Prevention

When it happens

Trigger: Calling createVaultProvider with a name that already exists for the same organizationId — typically a double-submit, retry after a timeout, or picking an existing name like 'default'.

Common situations: Duplicate form submissions, concurrent creation requests, retries after network errors, or assuming names are globally scoped instead of per-organization.

Related errors


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