{"record":{"id":"5a13addea03e2b22","repo":"Dokploy/dokploy","slug":"not-found-5a13ad","errorCode":"NOT_FOUND","errorMessage":"DNS provider not found","messagePattern":"DNS provider not found","errorType":"exception","errorClass":"TRPCError","httpStatus":404,"severity":"warning","filePath":"packages/server/src/services/dns-provider.ts","lineNumber":96,"sourceCode":"\t\t}\n\t\treturn newProvider;\n\t} catch (error) {\n\t\tif (isUniqueNameViolation(error)) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: \"CONFLICT\",\n\t\t\t\tmessage: `A DNS provider named \"${input.name}\" already exists in this organization`,\n\t\t\t});\n\t\t}\n\t\tthrow error;\n\t}\n};\n\nexport const findDnsProviderById = async (dnsProviderId: string) => {\n\tconst provider = await db.query.dnsProvider.findFirst({\n\t\twhere: eq(dnsProvider.dnsProviderId, dnsProviderId),\n\t});\n\tif (!provider) {\n\t\tthrow new TRPCError({\n\t\t\tcode: \"NOT_FOUND\",\n\t\t\tmessage: \"DNS provider not found\",\n\t\t});\n\t}\n\treturn provider;\n};\n\nexport const findDnsProviderInOrganization = async (\n\tdnsProviderId: string,\n\torganizationId: string,\n) => {\n\tconst provider = await findDnsProviderById(dnsProviderId);\n\tif (provider.organizationId !== organizationId) {\n\t\tthrow new TRPCError({\n\t\t\tcode: \"UNAUTHORIZED\",\n\t\t\tmessage: \"You are not allowed to access this DNS provider\",\n\t\t});\n\t}","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/dns-provider.ts#L78-L114","documentation":"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`).","triggerScenarios":"Resolving a DNS provider by an ID that has been deleted, mistyped, or belongs to another environment; domain/compose records referencing a stale dnsProviderId.","commonSituations":"Deleting a provider still referenced by domains; restoring a DB dump without provider rows; environment mismatch; cached frontend state after provider removal.","solutions":["List DNS providers and update the referencing record (domain/compose) to a valid providerId","Delete references to removed providers before removing them","Refresh provider caches/lists when this 404 appears","Confirm you're pointed at the right environment/database"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const p = await db.query.dnsProvider.findFirst({ where: eq(dnsProvider.dnsProviderId, id) });\nif (!p) { /* refresh provider references */ }","typeGuard":"const isDnsProvider = (p: unknown): p is DnsProvider =>\n  !!p && typeof (p as DnsProvider).dnsProviderId === \"string\";","tryCatchPattern":"try { return await findDnsProviderById(id); } catch (e) { if (e instanceof TRPCError && e.code === \"NOT_FOUND\") return null; throw e; }","preventionTips":["Clean up domain references before deleting providers","Never hardcode provider IDs across environments","Handle 404 with a list refresh"],"tags":["not-found","dns","lookup"],"backgroundTag":"resource-not-found","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}