{"record":{"id":"e9786fb0d728f1b9","repo":"Dokploy/dokploy","slug":"not-found-e9786f","errorCode":"NOT_FOUND","errorMessage":"Vault provider not found","messagePattern":"Vault provider not found","errorType":"exception","errorClass":"TRPCError","httpStatus":404,"severity":"error","filePath":"packages/server/src/services/vault-provider.ts","lineNumber":138,"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 vault 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 findVaultProviderById = async (vaultProviderId: string) => {\n\tconst provider = await db.query.vaultProvider.findFirst({\n\t\twhere: eq(vaultProvider.vaultProviderId, vaultProviderId),\n\t});\n\tif (!provider) {\n\t\tthrow new TRPCError({\n\t\t\tcode: \"NOT_FOUND\",\n\t\t\tmessage: \"Vault provider not found\",\n\t\t});\n\t}\n\treturn provider;\n};\n\nexport const findVaultProviderInOrganization = async (\n\tvaultProviderId: string,\n\torganizationId: string,\n) => {\n\tconst provider = await findVaultProviderById(vaultProviderId);\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 vault provider\",\n\t\t});\n\t}","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/vault-provider.ts#L120-L156","documentation":"findVaultProviderById queried the vault_provider table by vaultProviderId and got no row. The ID does not exist (never created, deleted, or malformed), so a NOT_FOUND tRPC error is thrown.","triggerScenarios":"Calling findVaultProviderById with an ID that isn't in the database — stale reference from another table, a typo/copy-paste ID, or a provider deleted earlier.","commonSituations":"Client caching old IDs after a provider was removed, orphaned foreign keys referencing a deleted provider, or environment mismatch (querying dev DB with a prod ID).","solutions":["Verify the ID exists: select * from vault_provider where vault_provider_id = '...'","Check whether the provider was deleted and re-create or update the referencing record to point at a valid provider","Confirm you're pointed at the right database/environment"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const provider = await db.query.vaultProvider.findFirst({ where: eq(vaultProvider.vaultProviderId, id) });\nif (!provider) throw new Error('invalid provider id');","typeGuard":"const isProvider = (p: typeof vaultProvider.$inferSelect | undefined): p is typeof vaultProvider.$inferSelect => !!p;","tryCatchPattern":"try { await findVaultProviderById(id); } catch (e) { if (e instanceof TRPCError && e.code === 'NOT_FOUND') { showNotFound(); return; } throw e; }","preventionTips":["Derive provider IDs from a freshly fetched org-scoped list","Never persist provider IDs across environments","Validate ID format (e.g. cuid/uuid) before calling"],"tags":["vault","not-found","database","trpc"],"backgroundTag":"record-not-found","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}