Dokploy/dokploy · error · TRPCError

NOT_FOUND

NOT_FOUND

Error message

SSO provider not found

What it means

findProviderForOrg looks up an SSO provider by providerId scoped to an organizationId. If no row matches both, it throws NOT_FOUND — the organization does not have that SSO provider (wrong id, deleted provider, or cross-org mixup).

Source

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

		issuer: provider.issuer,
		scopes: parsed.scopes,
		skipDiscovery: parsed.skipDiscovery,
	};
};

const findProviderForOrg = async (
	providerId: string,
	organizationId: string,
) => {
	const provider = await db.query.ssoProvider.findFirst({
		where: and(
			eq(ssoProvider.providerId, providerId),
			eq(ssoProvider.organizationId, organizationId),
		),
		columns: { providerId: true, issuer: true, oidcConfig: true },
	});
	if (!provider) {
		throw new TRPCError({
			code: "NOT_FOUND",
			message: "SSO provider not found",
		});
	}
	return provider;
};

export const listSsoProvidersForOrg = async (organizationId: string) => {
	return db.query.ssoProvider.findMany({
		where: and(
			eq(ssoProvider.organizationId, organizationId),
			isNotNull(ssoProvider.oidcConfig),
		),
		columns: { providerId: true, issuer: true, domain: true },
		orderBy: [asc(ssoProvider.createdAt)],
	});
};

View on GitHub (pinned to 546686ea35)

Solutions

  1. List the org's SSO providers and use the current providerId for the active organization
  2. Refresh client state after org switching or provider re-creation
  3. Ensure the organizationId passed matches the org that owns the provider
Defensive patterns

Strategy: try-catch

Validate before calling

const providers = await listSsoProviders(organizationId);
if (!providers.some(p => p.providerId === providerId)) { /* refresh provider selection */ }

Try / catch

try { await provider(providerId, organizationId) } catch (e) { if (e instanceof TRPCError && e.code === 'NOT_FOUND') { /* reload providers for active org */ } }

Prevention

When it happens

Trigger: Calling the forward-auth provider resolver with a providerId that does not exist for the given organizationId — e.g. a provider from another org, a deleted provider, or a stale id in client state.

Common situations: Switched active organization but the client still sends the previous org's providerId; provider was deleted and recreated with a new id; manual API call with a mistyped providerId.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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