n8n - ✅(Solved) Fix Wait node executions stuck forever: `dbTime.getTime is not a function` crashes wait-tracker poller (postgres) [1 pull requests, 2 comments, 3 participants]

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…
GitHub stats
n8n-io/n8n#28541Fetched 2026-04-16 07:05:02
View on GitHub
Comments
2
Participants
3
Timeline
6
Reactions
0
Timeline (top)
commented ×2subscribed ×2labeled ×1mentioned ×1

Error Message

Error repeats every 5s (polling interval of wait-tracker):

Root Cause

Root cause is in packages/@n8n/db/src/repositories/clock.repository.ts (dist:
@n8n/db/dist/repositories/clock.repository.js). In the getDbTime() method, the Postgres branch returns
now directly from the raw query result instead of wrapping it in a Date:

Fix Action

Fix / Workaround

Patching that single line to return new Date(now); fully resolves the issue — the poller stops crashing, backlog of waiting executions resumes correctly, new Wait-node executions complete normally.

Workaround verified: editing clock.repository.js to return new Date(now); in the postgres branch,
restarting the container — poller stops crashing, all stuck waiting executions resume, backlog drains, new
Wait nodes complete normally.

PR fix notes

PR #28641: fix: guard breaking-changes latestEvent sort against non-Date values

Description (problem / solution / changelog)

Summary

Defensively handle non-Date latestEvent values in the breaking-changes statistics sort path to avoid runtime errors like:

dbTime.getTime is not a function

Changes

  • Normalize latestEvent before calling getTime()
  • Fallback safely when the value is null, undefined, or invalid

Why this is safe

  • Preserves behavior for valid Date objects
  • Prevents runtime errors for malformed timestamp values
  • Small, isolated change

Validation

  • Added focused unit test for breaking-changes service
  • Ran targeted test suite successfully

Related issues

Related to #28640 and #28541

Changed files

  • packages/cli/src/modules/breaking-changes/__tests__/breaking-changes.service.test.ts (modified, +43/-0)
  • packages/cli/src/modules/breaking-changes/breaking-changes.service.ts (modified, +18/-3)
RAW_BUFFERClick to expand / collapse

Bug Description

On n8n 2.16.0 and 2.17.1 with a Postgres backend, the wait-tracker poller crashes with TypeError: dbTime.getTime is not a function every 5 seconds. As a consequence, no waiting execution is ever resumed — every workflow that hits a Wait node stays in waiting status indefinitely.

Root cause is in packages/@n8n/db/src/repositories/clock.repository.ts (dist:
@n8n/db/dist/repositories/clock.repository.js). In the getDbTime() method, the Postgres branch returns
now directly from the raw query result instead of wrapping it in a Date:

  if (this.databaseConfig.type === 'postgresdb') {            
      const [{ now }] = await this.dataSource.query('SELECT CURRENT_TIMESTAMP(3) AS now');
      return now;                 // ← should be: return new Date(now);                   
  }                                                                                                       
  // SQLite branch correctly wraps it:                                                                    
  const [{ now }] = await this.dataSource.query("SELECT STRFTIME(...) AS now");                           
  const date = new Date(now);                                                                             
  ...                                                                                                     
  return date;

Patching that single line to return new Date(now); fully resolves the issue — the poller stops crashing, backlog of waiting executions resumes correctly, new Wait-node executions complete normally.

To Reproduce

  1. Run n8n 2.16.0 or 2.17.1 with DB_TYPE=postgresdb (Postgres 16).
  2. Create any workflow containing a Wait node (e.g. "wait 10 seconds").
  3. Trigger the workflow.
  4. Observe in container logs: dbTime.getTime is not a function printed every 5s.
  5. Check DB: execution stays in waiting status forever; no resume, no success.

Expected behavior

The Wait node should pause execution for the configured interval and then resume the workflow. The
wait-tracker poller should not crash.

Debug Info

Error repeats every 5s (polling interval of wait-tracker):

  dbTime.getTime is not a function

Source of the crash: packages/cli/src/wait-tracker.ts (dist wait-tracker.js:64):

  const [executions, dbTime] = await Promise.all([
      this.executionRepository.getWaitingExecutions(),                                                    
      this.dbClock.getApproximateDbTime(),                    
  ]);                                                                                                     
  const skewMs = dbTime.getTime() - Date.now();   // crash here

DbClock.getApproximateDbTime() calls ClockRepository.getDbTime() which in the Postgres branch returns
the raw query field instead of a Date instance.

Workaround verified: editing clock.repository.js to return new Date(now); in the postgres branch,
restarting the container — poller stops crashing, all stuck waiting executions resume, backlog drains, new
Wait nodes complete normally.

Operating System

Ubuntu Linux (host kernel 5.4), n8n inside Docker (Alpine image)

n8n Version

2.17.1 (also reproduced on 2.16.0)

Node.js Version

24.14.1 (shipped in the official n8n Docker image)

Database

PostgreSQL

Execution mode

main (default)

Hosting

self hosted

extent analysis

TL;DR

The most likely fix is to patch the clock.repository.js file to return a Date instance instead of the raw query result in the Postgres branch.

Guidance

  • The issue is caused by the getDbTime() method in clock.repository.ts returning a raw query result instead of a Date instance when using a Postgres backend.
  • To verify the issue, check the container logs for the error message dbTime.getTime is not a function and observe that the execution stays in waiting status forever.
  • To mitigate the issue, patch the clock.repository.js file to return new Date(now) instead of now in the Postgres branch.
  • After patching, restart the container to apply the changes and verify that the wait-tracker poller stops crashing and waiting executions resume correctly.

Example

// packages/@n8n/db/src/repositories/clock.repository.ts
if (this.databaseConfig.type === 'postgresdb') {
  const [{ now }] = await this.dataSource.query('SELECT CURRENT_TIMESTAMP(3) AS now');
  return new Date(now); // Patched line
}

Notes

  • This fix only applies to n8n versions 2.16.0 and 2.17.1 with a Postgres backend.
  • The patch is a temporary workaround until an official fix is released.

Recommendation

Apply the workaround by patching the clock.repository.js file, as it has been verified to resolve the issue and allow waiting executions to resume correctly.

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 Wait node should pause execution for the configured interval and then resume the workflow. The
wait-tracker poller should not crash.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING