mux.error.codes

Provides checked symbols for native mux.* error codes. btech.* symbols are in btech.error.codes, and testing.* symbols are available as testing.error.codes in test suites.

Constants

SymbolString valueWhen raised
mux.error.codes.arg.invalidmux.arg.invalidAn API argument is invalid, including unknown checked-tree fields and invalid namespace definitions. Plain code strings passed to new, raise, is, and wrap are not syntax-validated.
mux.error.codes.unavailable.checkingmux.unavailable.checkingA runtime-only mux operation is used during @lua/check.
mux.error.codes.runtimemux.runtimemux.error.pcall normalizes a non-error failure, or runtime error logging has no structured code.
mux.error.codes.state.invalidmux.state.invalidA state namespace, key, value, or batch update is invalid.
mux.error.codes.state.value_too_largemux.state.value_too_largeA state write exceeds a configured per-value, entry, or object limit.
mux.error.codes.state.unavailablemux.state.unavailableState enumeration occurs outside an active callback or state changes during enumeration.
mux.error.codes.object.invalidmux.object.invalidAn object handle or database object is invalid, stale, or unsuitable for the requested operation.
mux.error.codes.object.unavailablemux.object.unavailableAn object operation is unavailable or native policy rejects the requested change.
mux.error.codes.flag.invalidmux.flag.invalidA flag constant or lookup in mux.world.flags is invalid.
mux.error.codes.power.invalidmux.power.invalidA power constant or lookup in mux.world.powers is invalid.
mux.error.codes.access.invalidmux.access.invalidA command-access constant or lookup in mux.world.access is invalid.
mux.error.codes.connection.invalidmux.connection.invalidA message, descriptor, Telnet-environment kind, or flow descriptor is invalid.
mux.error.codes.connection.unavailablemux.connection.unavailableFlow support is unavailable or the descriptor already has an active flow.
mux.error.codes.channel.invalidmux.channel.invalidA channel name, membership, or Channel handle is unknown or stale.
mux.error.codes.channel_flag.invalidmux.channel_flag.invalidA constant or lookup in mux.comsys.flags is invalid.
mux.error.codes.text.invalidmux.text.invalidStyled text, a style field, or a requested text width is invalid.
mux.error.codes.module.invalidmux.module.invalidA module name is invalid or a requested flow step is absent from its module.
mux.error.codes.module.unavailablemux.module.unavailableA required module cannot be loaded or is unavailable from the current module root.
mux.error.codes.internalmux.internalA native invariant fails, such as a catalog being unavailable, an impossible result kind being returned, or a registry count changing while it is copied. It is also the fallback for an out-of-range native error-code enum.

Examples

if value_size > limit then
  mux.error.raise(
    mux.error.codes.state.value_too_large,
    "state value exceeds the configured limit"
  )
end

if err:is(mux.error.codes.state) then
  -- Handles every mux.state.* failure.
end

Notes

Each leaf and intermediate node has a .code field, and tostring(node) returns that dotted string. The intermediate nodes are derived from the leaves, not native enum members: mux, mux.arg, mux.unavailable, mux.state, mux.object, mux.attribute, mux.flag, mux.power, mux.access, mux.connection, mux.channel, mux.channel_flag, mux.text, and mux.module, and mux.config. They are useful with mux.error.is for a whole-namespace check; for example, mux.error.codes.state matches every mux.state.* code.

Unknown node keys raise when looked up instead of returning nil, which makes a misspelled symbol fail at the point it is written. Nodes retain raw fields so LuaJIT 5.1’s pairs() can inspect them; LuaJIT has no __pairs metamethod. Their __newindex blocks adding a key, but an existing raw field can still be overwritten. Treat them as checked symbols, not as strictly immutable tables.

Pass a node or a plain string wherever mux.error accepts a code. Dotted, lower-case strings are the project convention, but new, raise, is, and wrap accept strings verbatim.

See Also