Dokploy/dokploy · error · TRPCError
BAD_REQUEST
BAD_REQUEST
Error message
Error deleting this Git provider
What it means
Catch-all for git-provider remove: any error from findGitProviderById (e.g. not found) or removeGitProvider that is not a TRPCError is rethrown as BAD_REQUEST. If the original error is not an Error instance, the generic message 'Error deleting this Git provider' is used.
Source
Thrown at apps/dokploy/server/api/routers/git-provider.ts:174
if (!isPrivileged && gitProvider.userId !== ctx.session.userId) {
throw new TRPCError({
code: "UNAUTHORIZED",
message: "You can only delete your own Git providers",
});
}
await audit(ctx, {
action: "delete",
resourceType: "gitProvider",
resourceId: gitProvider.gitProviderId,
resourceName: gitProvider.name ?? gitProvider.gitProviderId,
});
return await removeGitProvider(input.gitProviderId);
} catch (error) {
const message =
error instanceof Error
? error.message
: "Error deleting this Git provider";
throw new TRPCError({
code: "BAD_REQUEST",
message,
});
}
}),
});
View on GitHub (pinned to 546686ea35)
Solutions
- Refresh the provider list and confirm the ID still exists before retrying
- Detach deployments using the provider, then delete
- Check the original error message when present to identify FK/constraint failures
Example fix
// before
await trpc.gitProvider.remove.mutate({ gitProviderId });
// after
const providers = await trpc.gitProvider.list.query();
if (!providers.some((p) => p.gitProviderId === gitProviderId)) return; // already gone
await trpc.gitProvider.remove.mutate({ gitProviderId }); Defensive patterns
Strategy: try-catch
Validate before calling
const exists = (await trpc.gitProvider.list.query()).some(p => p.gitProviderId === gitProviderId); if (!exists) return; // treat as already deleted
Try / catch
try { await removeGitProvider(id) } catch (e) { if (e instanceof TRPCClientError && e.data?.code === 'BAD_REQUEST') { refreshList(); surface(e.message); } else throw e; } Prevention
- Guard against double-submit on delete buttons
- Detach deployments from a provider before deleting it
When it happens
Trigger: Deleting a gitProviderId that no longer exists (throwing inside findGitProviderById), or a DB failure during removeGitProvider. Non-Error throwables produce the generic message.
Common situations: Double-click delete where the first request already removed the row; stale provider list in the UI; DB constraint from linked deployments still referencing the provider.
Understand the failure class
Background: BAD_REQUEST error code: request rejected as invalid (HTTP 400) - causes and fixes across libraries — this error's family across 8 libraries.
Related errors
AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27).
Data as JSON: /api/errors/91d301ec98d83d9f.
Report an issue: GitHub.