Dokploy/dokploy · error · TRPCError

NOT_FOUND

NOT_FOUND

Error message

Vault provider not found

What it means

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.

Source

Thrown at packages/server/src/services/vault-provider.ts:138

		}
		return newProvider;
	} catch (error) {
		if (isUniqueNameViolation(error)) {
			throw new TRPCError({
				code: "CONFLICT",
				message: `A vault provider named "${input.name}" already exists in this organization`,
			});
		}
		throw error;
	}
};

export const findVaultProviderById = async (vaultProviderId: string) => {
	const provider = await db.query.vaultProvider.findFirst({
		where: eq(vaultProvider.vaultProviderId, vaultProviderId),
	});
	if (!provider) {
		throw new TRPCError({
			code: "NOT_FOUND",
			message: "Vault provider not found",
		});
	}
	return provider;
};

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

View on GitHub (pinned to 546686ea35)

Solutions

  1. Verify the ID exists: select * from vault_provider where vault_provider_id = '...'
  2. Check whether the provider was deleted and re-create or update the referencing record to point at a valid provider
  3. Confirm you're pointed at the right database/environment
Defensive patterns

Strategy: type-guard

Validate before calling

const provider = await db.query.vaultProvider.findFirst({ where: eq(vaultProvider.vaultProviderId, id) });
if (!provider) throw new Error('invalid provider id');

Type guard

const isProvider = (p: typeof vaultProvider.$inferSelect | undefined): p is typeof vaultProvider.$inferSelect => !!p;

Try / catch

try { await findVaultProviderById(id); } catch (e) { if (e instanceof TRPCError && e.code === 'NOT_FOUND') { showNotFound(); return; } throw e; }

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


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