Error codes
Errors that ShadowJS raises itself are ShadowError instances (error.name === "ShadowError") with a stable code.
Errors that ShadowJS raises itself are ShadowError instances (error.name === "ShadowError") with a stable code. Match on code, not on the message. In development the message is [shadow CODE] explanation; in production builds it is only SHADOW_CODE, so message text never reaches user bundles. ShadowError is exported from @shadow-js/core/extend.
| Code | Thrown when |
|---|---|
| WRITE_IN_MEMO | A signal or store was written inside a useMemo function (development) |
| CYCLE_DETECTED | A memo read itself while computing |
| INFINITE_LOOP | A flush ran more than 1000 passes |
| CONTEXT_MISSING | useContext found no provider and no default |
| NO_OWNER_ID | useId was called with no owner |
The same table lists the codes that only warn: NO_OWNER_EFFECT, NO_OWNER_CLEANUP, NO_OWNER_ERROR, FLUSH_IN_EFFECT, RUN_WITH_DISPOSED_OWNER and EACH_KEY_DUPLICATE. Warnings go through console.warn once per code.
Store misuse (writing the read-only view, a draft used after its update, a bad path) throws a plain TypeError with a ShadowStore prefix, and control-flow misuse (a Switch child that is not a Match, a stale Show accessor, an invalid Dynamic tag) throws a TypeError that names the component. The server renderer throws SsrError with SSR_TIMEOUT or SSR_BOUNDARY_WATERFALL; see SSR, hydration and streaming.