Diagnostics

OPTIMISTIC_WRITE_BEFORE_LOAD

Optimistic write to a source whose first answer has not landed; no guess is made.


What you saw

  • Kind: write
  • Severity: error (broken behavior)

The console report opens with [OPTIMISTIC_WRITE_BEFORE_LOAD] 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: "OPTIMISTIC_WRITE_BEFORE_LOAD", ownerPath, and loc. Diagnostics explains each line.


Why it fires

An optimistic setter ran before its source's first answer landed (createOptimistic(async fn), or createOptimisticStore(fn, seed) whose derive has not landed — the seed does not count). Before its first answer the source is loading: there is nothing on screen to be optimistic over (ruled 2026-11-03). Dev throws and makes no guess (an action rejects).


How to fix it

Repair: keep the pending items in a separate list (an outbox) until the source loads, or disable the action (the input) until the source has loaded.


In tests

captureArtifact from @solidjs/diagnostics runs a scenario with the diagnostics channel open and returns the events it saw. expectNoDiagnostics(artifact) fails while OPTIMISTIC_WRITE_BEFORE_LOAD is among them, with the events as evidence; after the fix, the code is gone from artifact.diagnostics. Check for regressions in tests shows the loop and the Vitest matcher form.


Learn more

Last updated: 11/16/26, 6:55 AMEdit this pageReport an issue with this page