Dokploy/dokploy · error · TRPCError

PRECONDITION_FAILED

PRECONDITION_FAILED

Error message

Set the authentication domain for this server before deploying the proxy.

What it means

deployForwardAuthOnServer first reads forward-auth settings for the server (via getForwardAuthSettings). If no settings exist — the authentication domain for the server was never configured — it throws PRECONDITION_FAILED telling the admin to set the authentication domain before deploying the proxy. Deployment is a two-step process: configure settings, then deploy.

Source

Thrown at packages/server/src/services/proprietary/forward-auth.ts:191

	return { callbackUrl: forwardAuthCallbackUrl(input.authDomain, input.https) };
};

export const removeForwardAuthSettings = async (serverId: string | null) => {
	const existing = await getForwardAuthSettings(serverId);
	if (!existing) return { ok: true } as const;
	await removeForwardAuthDomain(serverId);
	await db.delete(forwardAuthSettings).where(settingsWhere(serverId));
	return { ok: true } as const;
};

export const deployForwardAuthOnServer = async (input: {
	serverId?: string;
	providerId: string;
	organizationId: string;
}) => {
	const settings = await getForwardAuthSettings(input.serverId ?? null);
	if (!settings) {
		throw new TRPCError({
			code: "PRECONDITION_FAILED",
			message:
				"Set the authentication domain for this server before deploying the proxy.",
		});
	}

	const provider = await findProviderForOrg(
		input.providerId,
		input.organizationId,
	);
	const oidc = resolveOidcConfig(provider);

	await setupForwardAuth({
		serverId: input.serverId,
		oidc,
		cookieSecret: deriveCookieSecret(
			`${input.serverId ?? "host"}:${settings.baseDomain}`,
		),

View on GitHub (pinned to 546686ea35)

Solutions

  1. First call the forward-auth settings endpoint to set the authentication domain for this server, then retry deployment
  2. Pass the correct serverId so settings resolve to the intended server
  3. If settings were saved under another server, re-save them for the current one
Defensive patterns

Strategy: validation

Validate before calling

const settings = await getForwardAuthSettings(serverId);
if (!settings) { /* route admin to SSO settings first */ }

Try / catch

try { await deployForwardAuthOnServer(input) } catch (e) { if (e instanceof TRPCError && e.code === 'PRECONDITION_FAILED') { /* open settings wizard */ } }

Prevention

When it happens

Trigger: Calling setForwardAuthSettings/deploy flows before any forward-auth settings row exists for the target server — i.e. the authentication domain (e.g. auth.example.com) was never saved for this server.

Common situations: Fresh server setup where the admin jumps straight to deploying the proxy without first setting the auth domain; serverId omitted so settings are looked up for the null/default server while settings were saved for a specific server; settings saved for a different server instance.

Understand the failure class

Related errors


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