n8n - 💡(How to fix) Fix The hash tag in the Redis key did not correctly wrap instance UUID, causing slot allocation in Redis Cluster mode to fail

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

  • error: all

Root Cause

Redis Cluster uses hash tags (the contents inside curly braces '{}') to determine the slot allocation of keys. Currently, the key's hash tag content is only 'instance:', and the instance UUID '045ef03d-...' falls outside the curly brackets, resulting in:

  1. Hash tag invalid: All instance keys are calculated based on the same string 'instance:', meaning all keys are mapped to the same slot, completely losing the ability to shard by instance.
  2. Data Skew: In Redis Cluster, all queue-related keys are concentrated in a single slot, creating hotspot nodes that go against the original intent of cluster sharding.

Referring to BullMQ official documentation - Redis Cluster, prefixes should be fully wrapped inside curly braces, such as '{myprefix}', to ensure that keys with the same prefix fall into the same slot.

Code Example

n8n:{instance:}045ef03d-2a62-4f5d-8d76-da89bf5a1064

---

n8n:{instance:045ef03d-2a62-4f5d-8d76-da89bf5a1064}
RAW_BUFFERClick to expand / collapse

Bug Description

Checking the key in Redis in Queue mode reveals an abnormal format:

n8n:{instance:}045ef03d-2a62-4f5d-8d76-da89bf5a1064

The instance UUID is concatenated to the curly bracket '}' outside, not inside. The expected format should be:

n8n:{instance:045ef03d-2a62-4f5d-8d76-da89bf5a1064}

Root cause analysis

Redis Cluster uses hash tags (the contents inside curly braces '{}') to determine the slot allocation of keys. Currently, the key's hash tag content is only 'instance:', and the instance UUID '045ef03d-...' falls outside the curly brackets, resulting in:

  1. Hash tag invalid: All instance keys are calculated based on the same string 'instance:', meaning all keys are mapped to the same slot, completely losing the ability to shard by instance.
  2. Data Skew: In Redis Cluster, all queue-related keys are concentrated in a single slot, creating hotspot nodes that go against the original intent of cluster sharding.

Referring to BullMQ official documentation - Redis Cluster, prefixes should be fully wrapped inside curly braces, such as '{myprefix}', to ensure that keys with the same prefix fall into the same slot.

Related Code

  • 'RedisClientService.toValidPrefix()': Scenarios where '{' and '}' are simply added before and after prefix in cluster mode, without considering subsequent concatenation of dynamic content (such as instance ID). This method first closes the curly brackets for 'bullPrefix', then concatenates the UUID by the caller, causing the UUID to fall outside the hash tag.
  • 'ScalingService.setupQueue()': Bull prefix is generated by 'service.toValidPrefix(bullPrefix)', and the final key construction is only concatenated after the prefix closes the curly braces.
  • 'LeaderElectionClient': Also constructs keys using 'toValidPrefix()' + string concatenation, but has similar issues.
  • 'RedisConfig.prefix': Global Redis key prefix, default value 'n8n'.
  • 'BullConfig.prefix': Bull queue prefix, default value 'bull'.

To Reproduce

  1. Configure n8n in Queue mode using Redis Cluster.

  2. Start n8n (main + worker).

  3. Connect to Redis and execute KEYS n8n:* to view the key format.

  4. Observe that the key format is n8n:{instance:}<uuid> instead of n8n:{instance:<uuid>}.

Expected behavior

The hash tag in the Redis key should fully wrap 'instance:<uuid>', i.e., the format is 'n8n:{instance:045ef03d-2a62-4f5d-8d76-da89bf5a1064}' to ensure that keys from different instances are correctly distributed across different slots.

Debug Info

Debug info

core

  • n8nVersion: 2.23.3
  • platform: docker (self-hosted)
  • nodeJsVersion: 24.15.0
  • nodeEnv: production
  • database: postgres
  • executionMode: scaling (multi-main)
  • concurrency: -1
  • license: enterprise (production)
  • consumerId: 91dd5fce-af6b-400a-b1ab-cb3ab247178b

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: s3

pruning

  • enabled: true
  • maxAge: 4000 hours
  • maxCount: 100000 executions

client

  • userAgent: mozilla/5.0 (macintosh; intel mac os x 10_15_7) applewebkit/537.36 (khtml, like gecko) chrome/148.0.0.0 safari/537.36
  • isTouchDevice: false

security

  • secureCookie: false

cluster

  • instanceCount: 14
  • versions: 2.23.3
  • instances:
    • instanceKey: 32832c9f-20e1-49da-8b89-bb513490a5f5, hostId: webhook-n8n-webhook-54d9bfbdb8-wjxtl, instanceType: webhook, instanceRole: unset, version: 2.23.3
    • instanceKey: 5202514b-83d5-471a-9e18-623d1f87f97e, hostId: main-n8n-main-b4f77bf9d-q67jp, instanceType: main, instanceRole: leader, version: 2.23.3
    • instanceKey: af70f083-5602-43fc-a36e-de6e684722c3, hostId: main-n8n-main-b4f77bf9d-mlhvz, instanceType: main, instanceRole: follower, version: 2.23.3
    • instanceKey: 7cbc81a1-36cb-4840-b06f-5d3c2968d914, hostId: main-n8n-main-b4f77bf9d-dlmv8, instanceType: main, instanceRole: follower, version: 2.23.3
    • instanceKey: 5a008a4e-2766-46d4-9142-d861fa8b50ec, hostId: worker-n8n-worker-b7d9d8b5b-jqs77, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: e0004959-2cd4-48f2-ab23-55d95a0d03ae, hostId: worker-n8n-worker-b7d9d8b5b-8mck2, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: 2fd2c1ec-4bbc-4dc4-ba3e-8923a5134e0c, hostId: worker-n8n-worker-b7d9d8b5b-mx5sc, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: 71cc4c8a-a3cd-4e57-82b0-02378b5eb995, hostId: worker-n8n-worker-b7d9d8b5b-vcz4z, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: 3a282e79-f71b-4e65-9f5b-9ffa6f156be9, hostId: worker-n8n-worker-b7d9d8b5b-4nv88, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: b215a7f0-62b4-48bb-8223-cff16e8a727c, hostId: worker-n8n-worker-b7d9d8b5b-qntq4, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: 3b5459be-d30d-4254-894a-89ed54b1e77f, hostId: worker-n8n-worker-b7d9d8b5b-8v82t, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: a05652d7-09df-4096-8bb3-4c9421ad3dbf, hostId: worker-n8n-worker-b7d9d8b5b-vspdl, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: 045ef03d-2a62-4f5d-8d76-da89bf5a1064, hostId: worker-n8n-worker-b7d9d8b5b-mqsdn, instanceType: worker, instanceRole: unset, version: 2.23.3
    • instanceKey: e71111a4-871d-423c-bfc0-2fbdae96a367, hostId: worker-n8n-worker-b7d9d8b5b-lh8d4, instanceType: worker, instanceRole: unset, version: 2.23.3
  • checks:
    • check: hostid-clash, status: succeeded, warnings: -
    • check: lifecycle, status: succeeded, warnings: -
    • check: split-brain, status: succeeded, warnings: -
    • check: version-mismatch, status: succeeded, warnings: -

Generated at: 2026-06-09T07:50:42.334Z

Operating System

docker

n8n Version

2.23.3

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 hash tag in the Redis key should fully wrap 'instance:<uuid>', i.e., the format is 'n8n:{instance:045ef03d-2a62-4f5d-8d76-da89bf5a1064}' to ensure that keys from different instances are correctly distributed across different slots.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING