Dokploy/dokploy · warning · TRPCError

NOT_FOUND

NOT_FOUND

Error message

DNS provider not found

What it means

findDnsProviderById queries the DNS provider table by ID and throws NOT_FOUND when nothing matches. It's the standard lookup used by provider resolution helpers (e.g. building the provider adapter in `provider`, loading stored config in `existing`).

Source

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

		}
		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",
		});
	}
	return provider;
};

export const findDnsProviderInOrganization = async (
	dnsProviderId: string,
	organizationId: string,
) => {
	const provider = await findDnsProviderById(dnsProviderId);
	if (provider.organizationId !== organizationId) {
		throw new TRPCError({
			code: "UNAUTHORIZED",
			message: "You are not allowed to access this DNS provider",
		});
	}

View on GitHub (pinned to 546686ea35)

Solutions

  1. List DNS providers and update the referencing record (domain/compose) to a valid providerId
  2. Delete references to removed providers before removing them
  3. Refresh provider caches/lists when this 404 appears
  4. Confirm you're pointed at the right environment/database
Defensive patterns

Strategy: type-guard

Validate before calling

const p = await db.query.dnsProvider.findFirst({ where: eq(dnsProvider.dnsProviderId, id) });
if (!p) { /* refresh provider references */ }

Type guard

const isDnsProvider = (p: unknown): p is DnsProvider =>
  !!p && typeof (p as DnsProvider).dnsProviderId === "string";

Try / catch

try { return await findDnsProviderById(id); } catch (e) { if (e instanceof TRPCError && e.code === "NOT_FOUND") return null; throw e; }

Prevention

When it happens

Trigger: Resolving a DNS provider by an ID that has been deleted, mistyped, or belongs to another environment; domain/compose records referencing a stale dnsProviderId.

Common situations: Deleting a provider still referenced by domains; restoring a DB dump without provider rows; environment mismatch; cached frontend state after provider removal.

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/5a13addea03e2b22. Report an issue: GitHub.