EFFECT_WRITES_OWN_SOURCE
Effect's write provably feeds back into its own inputs; info for multi-effect rings (attribution enabled).
What you saw
- Kind:
perf - Severity:
info(advisory, delivered on the diagnostics channel and never printed) orwarn(code that works but is structurally wrong or expensive)
The console report opens with [EFFECT_WRITES_OWN_SOURCE] and the message, then an in line naming the owners that enclose the subject, root first, and an at line with the source location when the code was compiled with one.
In a captured artifact the same finding is an event with code: "EFFECT_WRITES_OWN_SOURCE", ownerPath, and loc.
Diagnostics explains each line.
Why it fires
An effect re-ran because of a write it made itself: its callback wrote a value that its own inputs depend on (directly, or through the memos the message names), so the flush settled in two passes and the screen rendered the pre-write value in between.
The effect converged — an infinite loop throws on its own — which is exactly why nothing else reports it.
Typical shapes: clamping (if (page() > max()) setPage(max())), resetting one signal when another changes, filling a default, normalizing input.
These fire only while attribution is enabled and describe cost, not incorrect behavior. The numbers in the message are measurements, not guesses.
How to fix it
The written value is a function of what the effect reads, so it is a memo: const page = createMemo(() => Math.min(rawPage(), max())), or normalize where the source is written (in the setter/handler) instead of correcting it afterwards.
The info form names a cycle relayed across several effects (A writes x, B reads x and writes y, A reads y) — same repair: derive every relayed value from the original inputs and drop the writes.
The walk follows graph edges only; a write fed back through untracked indirection is not claimed.
In tests
captureArtifact from @solidjs/diagnostics runs a scenario with the diagnostics channel open and returns the events it saw.
expectNoDiagnostics(artifact) fails while EFFECT_WRITES_OWN_SOURCE is among them, with the events as evidence; after the fix, the code is gone from artifact.diagnostics.
expectRerunBudget(artifact, max, { scope }) bounds how often a named scope may re-run, and expectNoWaste(artifact) fails on re-runs whose result was unchanged.
Both read the attribution records, which captureArtifact collects unless attribution: false is passed.
Check for regressions in tests shows the loop and the Vitest matcher form.
Learn more
- Diagnostics: every code, with its kind, severity, and trigger.
- Debugging reactivity: how to read a report and what each group of codes points at.
- Attribution: the engine whose records explain a re-run, a hold, or a waterfall.