Skip to content
mycl is in early development. The API may change before a stable release; it is not yet recommended for production use.

Error reference

Most of mycl’s runtime checks throw in production as compact coded errors of the form mycl: error <code>, visit https://mycl.dev/errors/<code> for more information.: the full message strings are stripped from production bundles to keep them small. A few validation checks (errors 9, 10, 11, 12, 13, 15, 16) are development-only, where the guard itself is stripped from production builds entirely, so those codes can never fire there. In development the complete message is thrown (or logged) inline for every code. Each page below states its own production behavior explicitly.

CodeMessage
1mycl: capability “{name}” called outside any registry scope. Wrap the call site with scope(), or use snapshot() before async boundaries.
2mycl: capability “{name}” resolved to a non-function value. Check your LayerStrategy.extract. It must return a function.
3mycl: invalid channel
4mycl: registered symbol (Symbol.for) cannot key the dispatch cache — use a unique Symbol()
5layer: target must be a capability
6layer: value cannot be undefined
7augment: target must be a capability
8augment: wrapper must be a function
9augment: received a builder (h => …) instead of a wrapper. Pass the wrapper directly: augment(cap, after(fn)).
10augment: wrapper threw during canary probe — wrappers must be pure composition and not throw on application. Caught: {caught}
11mycl: identifier path must be a non-empty string, got “{identity}“.
12mycl: channel name “{name}” must not contain a ”:” or ”/” separator.
13mycl: duplicate capability identifier “{identity}”: two capabilities resolve to the same identifier. Most likely a duplicate copy of the package that creates it (nested install or dual ESM+CJS load, run pnpm dedupe); otherwise two packages collide on the same identifier path.
14mycl: alsContext requires process.getBuiltinModule (Node 20.16 or newer, or a runtime that provides it). Use stackContext for synchronous scoping, or install your own ScopeContext via setChannelContext.
15mycl: merge() received an already-resolved registry, which cannot be re-composed. Pass it as the sole scope source instead: scope(fn, resolved) or mycl(make, resolved).
16mycl: this ScopeContext instance already backs channel “{name}”. A context belongs to one channel (sharing one collapses their scopes); mint a fresh context per channel.