n8n - 💡(How to fix) Fix Enterprise GIT & Project Deletion Fails with Large Set of Executions

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

QueryFailedError: canceling statement due to statement timeout at PostgresQueryRunner.query (...) at DeleteQueryBuilder.execute (...) at WorkflowService.delete (workflow.service.ts:916) at ProjectService.deleteProject (project.service.ee.ts:159) at ProjectController.deleteProject (project.controller.ts:370)

Root Cause

When using the Source Control (Git) enterprise feature to pull the latest version in an environment, if the incoming changeset includes the deletion of a project, the pull operation fails silently and never completes. The root cause is that n8n's internal deleteProject call times out with a QueryFailedError: canceling statement due to statement timeout when attempting to bulk-delete workflow executions belonging to the project, causing the entire Git pull to be aborted without surfacing a clear user-facing error. The operation succeeded when run manually after ~9 minutes, but by that point the Git pull had already been abandoned by n8n.

Code Example

QueryFailedError: canceling statement due to statement timeout
       at PostgresQueryRunner.query (...)
       at DeleteQueryBuilder.execute (...)
       at WorkflowService.delete (workflow.service.ts:916)
       at ProjectService.deleteProject (project.service.ee.ts:159)
       at ProjectController.deleteProject (project.controller.ts:370)
RAW_BUFFERClick to expand / collapse

Bug Description

When using the Source Control (Git) enterprise feature to pull the latest version in an environment, if the incoming changeset includes the deletion of a project, the pull operation fails silently and never completes. The root cause is that n8n's internal deleteProject call times out with a QueryFailedError: canceling statement due to statement timeout when attempting to bulk-delete workflow executions belonging to the project, causing the entire Git pull to be aborted without surfacing a clear user-facing error. The operation succeeded when run manually after ~9 minutes, but by that point the Git pull had already been abandoned by n8n.

The Git pull only succeeds after manually deleting the project (and its associated workflows and executions) directly from the database.

To Reproduce

  1. Create a team project in n8n with a large number of workflows and/or workflow executions.
  2. In a connected Git branch, delete the project (remove all associated workflow files and project config).
  3. Commit and push those changes to the remote branch.
  4. In the n8n production instance, navigate to Settings → Source Control and trigger a Pull from the remote.
  5. Observe that the pull operation fails/hangs. The instance logs will show:
    QueryFailedError: canceling statement due to statement timeout
        at PostgresQueryRunner.query (...)
        at DeleteQueryBuilder.execute (...)
        at WorkflowService.delete (workflow.service.ts:916)
        at ProjectService.deleteProject (project.service.ee.ts:159)
        at ProjectController.deleteProject (project.controller.ts:370)
  6. The Git pull never succeeds until the project, workflows, and executions are manually removed from the database.

Expected behavior

The Source Control pull should either:

Successfully apply the project deletion (including all workflows and their executions) without timing out, even when the execution history is large; or Handle the timeout gracefully, retry the deletion asynchronously, and still allow the Git pull to complete (or roll back cleanly with a meaningful error surfaced in the UI). The Git pull should never be left in a broken/incomplete state due to a downstream DB timeout during project deletion.

Debug Info

QueryFailedError: canceling statement due to statement timeout at PostgresQueryRunner.query (/usr/local/lib/node_modules/n8n/node_modules/.pnpm/@[email protected]_.../src/driver/postgres/PostgresQueryRunner.ts:331:19) at processTicksAndRejections (node:internal/process/task_queues:104:5) at DeleteQueryBuilder.execute (...DeleteQueryBuilder.ts:77:33) at WorkflowService.delete (...workflow.service.ts:916:3) at ProjectService.deleteProject (...project.service.ee.ts:159:5) at ProjectController.deleteProject (...project.controller.ts:370:3) at handler (...controller.registry.ts:111:12) at .../response-helper.ts:118:17

Timestamp: 2026-05-21T10:27:34Z Query duration before timeout: ~9 minutes (query eventually completed successfully when run manually)

Operating System

Azure Container Apps

n8n Version

2.22.0

Node.js Version

24.15.0

Database

PostgreSQL

Execution mode

queue

Hosting

self hosted

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The Source Control pull should either:

Successfully apply the project deletion (including all workflows and their executions) without timing out, even when the execution history is large; or Handle the timeout gracefully, retry the deletion asynchronously, and still allow the Git pull to complete (or roll back cleanly with a meaningful error surfaced in the UI). The Git pull should never be left in a broken/incomplete state due to a downstream DB timeout during project deletion.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

n8n - 💡(How to fix) Fix Enterprise GIT & Project Deletion Fails with Large Set of Executions