Applied AI
LangGraph duplicate fan-out can rerun a cached LLM node
Catch repeated LangGraph node work when duplicate Send inputs share one cache key and only one task receives cached writes.
November 5, 2026
A LangGraph graph fans out three Send inputs: 1, 1, and 2. The node uses CachePolicy, and a warm cache should spare all three calls. In a new issue, the output remains correct, yet one duplicate node runs again on every subsequent invocation. When that node calls an LLM, the failure appears in latency and cost rather than answer quality.
Measure work, not only answers
LangGraph's graph API documents node caching by input. Instrument the node with a call counter and request ID. Run the same graph twice with duplicate and distinct inputs, then compare worker calls, cache-hit records, outputs, and billed model calls. A result equality test alone misses this case. Keep the cache namespace and key function in the evidence, because two inputs that look alike in logs may intentionally map to different keys.
Decide whether duplicates are legitimate
Before deduplicating upstream, ask whether two branches represent two independent business obligations. If they do, one cached result may be reusable, but each branch still needs its own state update and audit record. If duplicates are accidental, remove them before Send. If they are deliberate, test that a warm cache applies the same writes to every matching task. The issue points to matching tasks being placed in a dictionary keyed by cache key, which can overwrite siblings; a maintainer agreed with that diagnosis and proposed grouping tasks per key.
Add a release gate for cost and correctness
Use a small fan-out fixture with duplicate keys and assert expected output multiplicity plus zero worker calls on a warm second run. Include a version pin and rerun this test before upgrades. Until a released fix is confirmed, budget for the redundant calls or use a tested application-level deduplication design. Do not suppress a branch without proving its output still appears.
Adovo’s view
Correct answers can hide a wasteful machine. Production AI needs two ledgers: what the user received and what the system had to execute to deliver it. A cache earns its place only when both ledgers agree.
