{"record":{"id":"38c61f103af35d64","repo":"solidjs/solid","slug":"potential-infinite-loop-detected","errorCode":null,"errorMessage":"Potential Infinite Loop Detected.","messagePattern":"Potential Infinite Loop Detected\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/solid/src/reactive/signal.ts","lineNumber":1369,"sourceCode":"      if (!TransitionRunning) node.value = value;\n    } else node.value = value;\n    if (node.observers && node.observers.length) {\n      runUpdates(() => {\n        for (let i = 0; i < node.observers!.length; i += 1) {\n          const o = node.observers![i];\n          const TransitionRunning = Transition && Transition.running;\n          if (TransitionRunning && Transition!.disposed.has(o)) continue;\n          if (TransitionRunning ? !o.tState : !o.state) {\n            if (o.pure) Updates!.push(o);\n            else Effects!.push(o);\n            if ((o as Memo<any>).observers) markDownstream(o as Memo<any>);\n          }\n          if (!TransitionRunning) o.state = STALE;\n          else o.tState = STALE;\n        }\n        if (Updates!.length > 10e5) {\n          Updates = [];\n          if (IS_DEV) throw new Error(\"Potential Infinite Loop Detected.\");\n          throw new Error();\n        }\n      }, false);\n    }\n  }\n  return value;\n}\n\nfunction updateComputation(node: Computation<any>) {\n  if (!node.fn) return;\n  cleanNode(node);\n  const time = ExecCount;\n  runComputation(\n    node,\n    Transition && Transition.running && Transition.sources.has(node as Memo<any>)\n      ? (node as Memo<any>).tValue\n      : node.value,\n    time","sourceCodeStart":1351,"sourceCodeEnd":1387,"githubUrl":"https://github.com/solidjs/solid/blob/f47845f9cc16ecbb316aa6560c7161f45af9a3d8/packages/solid/src/reactive/signal.ts#L1351-L1387","documentation":"Solid detects that its internal update queue has exceeded one million entries, which is practically only reachable via an infinite reactive loop: a computation synchronously writing a signal it also reads. It clears the queue and (in dev) throws with a descriptive message so the loop is attributable rather than freezing the tab.","triggerScenarios":"createEffect(() => setCount(count() + 1)); or any effect/memo that synchronously sets a signal in its own dependency chain; mutual effects that ping-pong writes; writing to a store inside a memo that reads the same store path.","commonSituations":"Porting React setState-in-render patterns; accidentally calling a setter inside a createMemo; forgetting untrack/batch around a write triggered from a computation; infinite loop between two effects each updating the other's dependency.","solutions":["Find the effect that writes a signal it also reads and break the cycle: move the write to an event handler or async boundary","Use untrack(() => setter(...)) when the write is intentionally not a dependency","Restructure derived values as createMemo instead of effect+signal pairs"],"exampleFix":"// before\nconst [count, setCount] = createSignal(0);\ncreateEffect(() => setCount(count() + 1)); // infinite loop\n\n// after\nconst [count, setCount] = createSignal(0);\nconst doubled = createMemo(() => count() * 2); // derive, don't write","handlingStrategy":"validation","validationCode":"// Pattern-check effects before shipping: an effect must not synchronously write a signal it reads\nconst writes = collectSetters(effectBody); // lint/AST step in CI\nif (writes.intersects(collectReads(effectBody))) fail('effect writes its own dependency');","typeGuard":null,"tryCatchPattern":"try { runApp(); } catch (e) { if (/Infinite Loop/i.test(String(e))) locateSelfWritingEffect(); else throw e; }","preventionTips":["Never call a setter synchronously inside an effect that reads the same signal","Derive values with createMemo instead of effect + signal","Use untrack around intentional writes inside computations"],"tags":["solid","infinite-loop","reactivity","effect","signal"],"backgroundTag":"reactive-infinite-loop","analyzedSha":"f47845f9cc16ecbb316aa6560c7161f45af9a3d8","analyzedAt":"2026-08-27T05:39:24.283Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}