Skip to content

ErrorCode

Defined in: src/enums/ErrorCode.ts:8

Stable, machine-readable codes attached to every AccessControlError (err.code). Branch on these instead of parsing message strings — messages are redacted by default (engine.safeErrors) and may change wording, but codes are part of the public contract.

INVALID_NAME: "INVALID_NAME"

Defined in: src/enums/ErrorCode.ts:10

A name (role/resource/action/group/category) is empty or malformed.


RESERVED_NAME: "RESERVED_NAME"

Defined in: src/enums/ErrorCode.ts:12

A name is a reserved prototype-pollution keyword (__proto__, …).


INVALID_QUERY: "INVALID_QUERY"

Defined in: src/enums/ErrorCode.ts:14

A check query (IQueryInfo passed to can/check) is malformed.


INVALID_GRANT: "INVALID_GRANT"

Defined in: src/enums/ErrorCode.ts:16

A grant rule / grants object / IAccessInfo has an invalid shape.


INVALID_SETUP: "INVALID_SETUP"

Defined in: src/enums/ErrorCode.ts:18

The setup() vocabulary object is malformed.


INVALID_ACTION: "INVALID_ACTION"

Defined in: src/enums/ErrorCode.ts:20

An action name or possession is invalid.


ROLE_NOT_FOUND: "ROLE_NOT_FOUND"

Defined in: src/enums/ErrorCode.ts:22

A referenced role does not exist.


INVALID_INHERITANCE: "INVALID_INHERITANCE"

Defined in: src/enums/ErrorCode.ts:24

Inheritance is invalid (self-extend, cross-inheritance, non-existent).


UNKNOWN_ACTION: "UNKNOWN_ACTION"

Defined in: src/enums/ErrorCode.ts:26

strict.actions: the checked action is not in the known set.


UNKNOWN_RESOURCE: "UNKNOWN_RESOURCE"

Defined in: src/enums/ErrorCode.ts:28

strict.resources: the checked resource is not in the known set.


LOCKED: "LOCKED"

Defined in: src/enums/ErrorCode.ts:30

A mutation was attempted after lock().


ASYNC_REQUIRED: "ASYNC_REQUIRED"

Defined in: src/enums/ErrorCode.ts:32

The check needs the async path (a custom/async { fn } condition).


INVALID_CONDITION: "INVALID_CONDITION"

Defined in: src/enums/ErrorCode.ts:34

A condition is malformed, uncompiled, or nested too deep.


UNKNOWN_CONDITION_FN: "UNKNOWN_CONDITION_FN"

Defined in: src/enums/ErrorCode.ts:36

A custom condition function name is not registered.


REGEX_DISABLED: "REGEX_DISABLED"

Defined in: src/enums/ErrorCode.ts:38

The matches operator is disabled (engine.allowRegex is off).


UNSAFE_REGEX: "UNSAFE_REGEX"

Defined in: src/enums/ErrorCode.ts:40

A regular expression is malformed or potentially catastrophic.