Diagnostics

INVALID_AFFECTS_TARGET

affects() given a key path, or a key on an accessor.


What you saw

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

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


Why it fires

affects() expects a Solid source accessor or store node, with at most one optional key (keys only valid on store targets).


How to fix it

Fix the target or drop the extra keys.


In tests

captureArtifact from @solidjs/diagnostics runs a scenario with the diagnostics channel open and returns the events it saw. expectNoDiagnostics(artifact) fails while INVALID_AFFECTS_TARGET 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: 10/15/26, 10:07 PMEdit this pageReport an issue with this page