Skip to content

Error codes and exceptions

An ExecKernel error identifies a failed operation, but its representation depends on the interface your application uses. The core exposes domain exceptions; SDKs normalize local or remote failures; HTTP adapters choose response codes and fields. Start with the observed interface and ek_code/code, then inspect the associated context.

Core exceptions derive from ExecKernel\Exception\ExecKernelException.

Member Contract
ekCode: string Readonly ExecKernel identifier such as EK-STATE-007.
getMessage(): string Explanation supplied by the producer; do not parse it as a stable identifier.
context: array Readonly associated data. Fields depend on the exception and call site.
severity: string Readonly severity; explicit value, catalogue default or family fallback.
hint: ?string Optional readonly recovery hint.
httpStatus(): int / getCode() The exception’s integer status, default 400 unless overridden. It is not ekCode and does not dictate every adapter’s HTTP mapping.

The severity vocabulary is INFO, WARNING, RULE_FAILURE, BLOCKER and FATAL. Severity describes the domain classification; it does not prescribe a retry, process exit or universal HTTP status.

ExecKernel::toErrorResponse converts a core exception to {"error": …} with ek_code, message, severity, context, hint and a Unix timestamp. It also emits error observations. For example, a SessionNotFoundException('session-ref') converted at timestamp 1700000000 yields:

{
"error": {
"ek_code": "EK-SESSION-001",
"message": "Sesión no encontrada.",
"severity": "BLOCKER",
"context": {"session_id": "session-ref"},
"hint": null,
"timestamp": 1700000000
}
}

The message remains the core’s supplied text. For an unrelated Throwable, this conversion uses EK-INT-999, severity FATAL and the exception class in context, with a generic message.

ExceptionFactory::fromCode(string $code, array $context = []): ExecKernelException and fromArray(array $data): ExecKernelException reconstruct errors. A concrete exception is used only when it can preserve the supplied code, message, metadata and context faithfully; otherwise the result is GenericExecKernelException. Code aliases ek_code, ekCode and code must agree when present in a wire envelope. Invalid or conflicting wire codes fall back to EK-SYS-001 in this factory.

Constructor and configuration failures can also be ordinary PHP InvalidArgumentException, TypeError or ValueError. They do not acquire a domain code merely because they occur during integration.

The tables below cover the entries in ErrorCatalog::get(). Meanings describe their default catalogue interpretation, and the associated types identify constructors using those codes. A code is not necessarily unique to one class or producer; additional validation uses and context distinctions follow the tables.

Download the catalogue and exception index for exact default messages and a searchable class index. Catalogue presence alone does not mean every adapter can emit or reconstruct a dedicated class for that code.

Code Meaning Severity Associated exception types
EK-VALID-001 General validation failure. FATAL EmptyGraphException, FlowConfigurationException, GraphValidationException, InvalidMetadataException, InvalidNodeTypeException
EK-VALID-002 Inconsistent graph structure. FATAL InconsistentGraphException
EK-VALID-003 Strict validation requirements not met. FATAL StrictValidationException
EK-GRAPH-001 Missing root node. FATAL MissingRootError, MissingRootException
EK-GRAPH-002 Multiple root nodes. FATAL MultipleRootsException
EK-GRAPH-003 Duplicate node identifier. FATAL DuplicateNodeIdException
EK-GRAPH-004 Duplicate edge identifier. FATAL DuplicateEdgeIdException
EK-GRAPH-005 Duplicate connection between nodes. FATAL DuplicateEdgeException
EK-GRAPH-006 Edge references a missing node. FATAL BrokenReferenceException
EK-GRAPH-007 Terminal node has outgoing edges. FATAL TerminalNodeHasEdgesException
EK-GRAPH-008 Node is unreachable from the root. FATAL UnreachableNodeException
EK-GRAPH-060 Graph or DSL version incompatible with the engine. FATAL VersionCompatibilityException
EK-IMPORT-001 Schema node lacks a valid ID. FATAL ImporterMissingNodeIdException
EK-IMPORT-002 Schema edge references a missing node. FATAL ImporterBrokenEdgeReferenceException, UnknownNodeError
EK-IMPORT-003 Unsupported schema rule type. FATAL ImporterUnsupportedRuleException
EK-IMPORT-004 Invalid schema terminal output. FATAL ImporterInvalidTerminalOutputException, InvalidTerminalError
EK-IMPORT-005 Malformed JSON schema input. FATAL ImporterMalformedSchemaException
Code Meaning Severity Associated exception types
EK-META-001 Duplicate metadata for a node and language. WARNING DuplicateMetadataException
EK-META-002 Duplicate label for an edge and language. WARNING DuplicateLabelException
EK-META-003 Unrecognized language. WARNING UnknownLanguageException
EK-META-004 Required metadata or label unavailable. WARNING MissingLabelException, MissingMetadataException, NodeMetadataMissingException
EK-WARN-033 Deprecated import/export element. WARNING Catalogue entry
EK-OUTPUT-001 Outputs attached to a nonterminal node. FATAL NonTerminalOutputException
EK-OUTPUT-002 Invalid or missing output. FATAL InvalidOutputException, InvalidOutputFormatException, MissingOutputException
EK-LOADER-001 Invalid ArrayGraphLoader input. FATAL LoaderInvalidArrayException
EK-LOADER-002 SQL loader query failure. FATAL SqlLoaderQueryException
EK-LOADER-003 Broken or incompatible SQL schema. FATAL BrokenSqlSchemaException
EK-LOADER-004 Importer or DSL parsing failure. FATAL ImporterParseException, MermaidSyntaxError
Code Meaning Severity Associated exception types
EK-RULE-001 Unknown rule type. RULE_FAILURE UnknownRuleTypeException
EK-RULE-002 Malformed rule. RULE_FAILURE InvalidRuleFormatException
EK-RULE-003 Edge conditions are not satisfied. BLOCKER ConditionEvaluationException, EdgeConditionBlockedException
EK-RULE-004 Condition references a missing edge; also used by a rule evaluation timeout. RULE_FAILURE BrokenConditionReferenceException, RuleEvaluationTimeoutException
EK-RULE-006 Rule circuit breaker is open. RULE_FAILURE RuleCircuitOpenException
EK-RULE-021 Sandbox execution failure. RULE_FAILURE SandboxRuntimeException
EK-RULE-022 Invalid sandbox return value. RULE_FAILURE SandboxInvalidReturnException
EK-FATAL-003 Sandbox unavailable. FATAL SandboxDriverUnavailableException
EK-DSL-001 Invalid TimeDSL syntax. RULE_FAILURE TimeDslException
EK-DSL-002 Invalid TimeDSL block header. RULE_FAILURE TimeDslException
EK-DSL-003 Unclosed TimeDSL block. RULE_FAILURE TimeDslException
EK-DSL-004 Cron mixed with temporal-window rules. RULE_FAILURE Catalogue entry
EK-DSL-005 Additional rules attached to cron. RULE_FAILURE Catalogue entry
EK-DSL-006 Invalid TimeDSL date range. RULE_FAILURE TimeDslException
EK-DSL-007 Invalid TimeDSL time range. RULE_FAILURE TimeDslException
EK-DSL-008 Invalid TimeDSL weekday. RULE_FAILURE TimeDslException
EK-DSL-009 Invalid TimeDSL session-age range. RULE_FAILURE TimeDslException
EK-DSL-010 Unknown TimeDSL expression. RULE_FAILURE TimeDslException
EK-DSL-011 Invalid TimeDSL date. RULE_FAILURE TimeDslException
EK-DSL-012 Invalid TimeDSL time. RULE_FAILURE TimeDslException
EK-DSL-013 Unknown TimeDSL edge. RULE_FAILURE TimeDslException
Code Meaning Severity Associated exception types
EK-CYCLE-002 Direct self-loop. BLOCKER DirectCycleException
EK-CYCLE-003 Risk of an infinite loop. BLOCKER InfiniteLoopRiskException
EK-SELECT-001 Invalid edge selection for the current state. BLOCKER EdgeNotAllowedException, EdgeNotFoundException, InvalidEdgeSelectionException
EK-SELECT-002 Invalid destination node. BLOCKER InvalidNodeSelectionException, NodeNotFoundException
EK-SELECT-003 No edge selected. BLOCKER MissingSelectionException
EK-CYCLE-001 Edge already used in this session. BLOCKER EdgeReuseException
EK-SESSION-001 Session not found. BLOCKER SessionNotFoundException
EK-SESSION-002 Invalid or corrupt session state. FATAL InvalidSessionStateException, SessionStateCorruptedException
EK-SESSION-003 Context key unavailable. BLOCKER ContextAccessException, ContextKeyMissingException
EK-STATE-004 Cannot continue from a terminal node. BLOCKER TerminalNodeTransitionException
EK-STATE-007 Session persistence conflict. BLOCKER SessionPersistenceConflictException
EK-LOCK-001 Session lock could not be acquired. BLOCKER SessionLockNotAcquiredException
EK-RACE-001 Concurrent navigation detected. BLOCKER ConcurrentNavigationException
Code Meaning Severity Associated exception types
EK-PERF-001 Engine operation or navigation duration exceeded. BLOCKER NavigationTimeExceededException, NodeExecutionTimeExceededException
EK-PERF-002 Custom rule duration exceeded. BLOCKER UserRuleTooSlowException
EK-PERF-003 Payload size or context entry limit exceeded. BLOCKER ContextLimitExceededException, PayloadTooLargeException
EK-SEC-NAV-001 Invalid edge for the current node. BLOCKER InvalidEdgeException
EK-SEC-NAV-002 Edge blocked by its conditions. BLOCKER ForbiddenEdgeException
EK-SEC-CYC-001 Repeated edge in the session. BLOCKER RaulCycleException
EK-SEC-CON-001 Invalid or failed rule. RULE_FAILURE RuleFailureException
EK-SEC-CTX-001 Invalid or prohibited context key. BLOCKER InvalidContextKeyException
EK-SEC-LOD-001 Invalid or corrupt graph structure. FATAL InvalidGraphStructureException
EK-SEC-SES-001 Session integrity failure. BLOCKER SessionIntegrityException
EK-SEC-POL-001 Edge prohibited by security policy. BLOCKER ForbiddenEdgePolicyException
EK-SEC-POL-002 Maximum traversal depth exceeded. BLOCKER MaxDepthExceededException
EK-SEC-POL-003 Transition frequency limit exceeded. BLOCKER TransitionRateLimitExceededException
EK-SEC-POL-004 Session-state size limit exceeded. BLOCKER SessionStateSizeExceededException
Code Meaning Severity Associated exception types
EK-API-001 Invalid request. BLOCKER InvalidFlowIdException, MalformedRequestException
EK-API-002 Missing required parameter. BLOCKER MissingParameterException
EK-API-003 Unauthorized request. BLOCKER UnauthorizedException
EK-API-004 Flow not found. BLOCKER FlowNotFoundException, MissingFlowException
EK-REPLAY-001 Incomplete or inconsistent session data for replay. BLOCKER ReplayMissingSessionDataException
EK-REPLAY-002 Incompatible replay engine version. BLOCKER ReplayIncompatibleEngineVersionException
EK-REPLAY-003 Nondeterministic rule encountered during replay. RULE_FAILURE ReplayNonDeterministicRuleException
EK-VERSION-100 Incompatible SDK/API declaration. BLOCKER SdkApiCompatibilityException
EK-SYS-001 Unexpected error. FATAL UnexpectedException
EK-SYS-002 External dependency failure. FATAL DependencyFailureException
EK-SYS-003 Serialization failure. FATAL SerializationException

Additional producer codes and overlapping meanings

Section titled “Additional producer codes and overlapping meanings”

Validation stages can supply a code to GraphValidationException instead of using its general default.

Code Producer meaning
EK-GRAPH-003 / 004 Structural validation also uses these for missing/invalid node or edge IDs. Read the message and context to distinguish them from duplicates.
EK-GRAPH-010 Invalid/missing endpoint reference or invalid condition edge reference.
EK-GRAPH-011 Orphan metadata/output or invalid label reference.
EK-GRAPH-020 Terminal root or nonterminal node without outgoing edges.
EK-GRAPH-021 Terminal node with outgoing edges.
EK-GRAPH-030 Invalid endpoint representation or node/edge structural relationship.
EK-GRAPH-031 Direct self-loop.
EK-GRAPH-032 Duplicate origin/destination connection.
EK-GRAPH-040 Invalid condition/parameters, or a statically proven contradictory conjunction.
EK-GRAPH-041 Invalid custom handler, handler outside the allowlist, or missing allowlist in strict custom-rule validation.
EK-GRAPH-050 Node unreachable from the root.
EK-GRAPH-051 No terminal or no structural path to a terminal.
EK-VALIDATION-001 TemporalValidationException: invalid temporal data or ordering.

An array-loader boundary can wrap these as EK-SEC-LOD-001 while retaining validation_ek_code in context. The graph schema explains validation entry points.

Other constructors and parsers add these codes outside the central catalogue:

Code Exception or source Meaning and useful data
EK-PERF-004 HistoryLimitExceededException history_type, entries, max_entries; rejected history overflow.
EK-PERSIST-003 SessionPersistenceTimeoutException operation, duration_ms, max_ms, session_id.
EK-TIME-002 SessionExpiredException session_start, session_age, session_ttl, reason, idle_age, idle_ttl, hard_expiration.
EK-INPUT-400 Core middleware RequestInputException Invalid request fields or conflicting declarations; context depends on the caller.
EK-INT-999 Core error conversion Unhandled non-domain failure; generic public message and exception class.
EK-DSL-014 TimeDslException reason=duplicate_clause.
EK-DSL-015 TimeDslException Missing reference date or unresolved today marker.
EK-DSL-016 TimeDslException Trailing input after a time block.
EK-DSL-017 TimeDslException Empty time block.
EK-DSL-018 TimeDslException Invalid cron expression.
EK-DSL-019 TimeDslException Invalid integer.

EK-RULE-004 has two distinct constructors: BrokenConditionReferenceException carries condition_id and edge_id; RuleEvaluationTimeoutException carries duration_ms, max_ms, rule and optional edge_id. The code alone cannot distinguish them.

EK-PERF-003 can describe payload bytes or context entries. PayloadTooLargeException supplies size_bytes, max_bytes, payload_type and node_id; ContextLimitExceededException supplies entries, max_entries, estimated_bytes, payload_type and policy.

Failure Fields to inspect Relevant contract
Invalid context key invalid_keys Configuration and limits.
Invalid state reason and field-specific data State serialization.
Malformed rule rule, field, reason where supplied Rule parameters.
Blocked navigation ForbiddenEdgeException: edge_id; optional rule, reason, blocked_ek_code and details The outer code is EK-SEC-NAV-002; the underlying condition code can differ.
Persistence conflict session_id; optional expected_hash and actual_hash Concurrency and revisions.
Lock unavailable session_id; optional lock_key and ttl_seconds Lock-provider state; a later retry is an application decision.
Integrity failure reason and producer-supplied data Verify the persisted representation and key configuration before reuse.
Replay failure reason, expected_version/actual_version or rule_type State export and replay.

These are available diagnostic fields, not a closed schema guaranteed on every wire error. A remote adapter may intentionally omit domain context.

The standalone API has an explicit exception mapper. Its ordinary mapped response is:

{
"error": {
"code": "EK-INPUT-400",
"message": "Session not found.",
"details": {
"http": 400,
"trace_id": "request-ref-01"
}
}
}

This illustrates a missing or expired session. The actual request supplies or receives its trace identifier. The mapper emits fixed public messages and does not forward arbitrary core context.

Observed API code HTTP status Mapped condition
EK-INPUT-400 400 Invalid request/context/language, or missing/expired session.
EK-FLOW-404 404 Missing flow or route; selected loader identity mismatch.
EK-NODE-404 404 NodeNotFoundException.
EK-EDGE-404 400 Missing, disallowed or invalid edge selection. The code’s suffix does not make this a 404 response.
EK-CYCLE-001 409 Reused edge or mapped cycle failure.
EK-RULE-403 403 Forbidden edge, failed condition/rule or prohibited edge policy.
EK-STATE-007 409 Session persistence conflict.
EK-SEC-SES-001 409 Session integrity failure.
EK-RATE-429 429 Session-request limiter or deployment ingress limiter.
EK-API-003 401 Bundled deployment bearer authentication failure.
EK-ENGINE-500 500 Unmapped exception or generic dependency failure.
EK-ENGINE-500 503 Deployment bootstrap/backend unavailable.
EK-INPUT-400 413 Bundled Nginx request body limit.

The session limiter created by createApp can add session_id, window_seconds and max_requests to details. Nginx’s rate-limit envelope includes http and trace_id. These are different producers of the same API code.

For example, core SessionNotFoundException carries EK-SESSION-001 and its own 404 status, while the standalone API deliberately returns EK-INPUT-400 / 400. HTTP API endpoints specifies the operations; core HTTP middleware documents its separate mapping.

SDK representations and transport failures

Section titled “SDK representations and transport failures”

The PHP SDK exception namespace is ExecKernel\Exceptions, plural; it is distinct from the core’s ExecKernel\Exception. Read code() and details() on the SDK exception. Remote codes in the EK-SESSION, EK-STATE, EK-CYCLE and EK-SELECT families map to ExecKernelInvalidStateException; other remote codes use ExecKernelRemoteErrorException. This mapping uses the received code, so a standalone-API EK-INPUT-400 missing-session error follows the remote-error branch.

Connection and timeout failures use ExecKernelConnectionException and ExecKernelTimeoutException. Transport eligibility is recorded by details.retryable_transport; operation mutability and configured RetryPolicy still control whether a request repeats. A generic unexpected local throwable is wrapped with EK-SYS-001. A generic transport failure can use EK-SYS-002 with retry disabled.

JavaScript ExecKernelError exposes ekCode, type, context, optional severity and hint; isCode(prefix) performs a prefix check. fromUnknown accepts core/API envelope aliases and merges diagnostic details with context, preserving valid HTTP/trace metadata. Invalid or contradictory codes use EK-EXTERNAL-000.

JavaScript transport failure Result
Fetch rejects EK-EXTERNAL-000, type NetworkError.
Invalid JSON on a successful HTTP response EK-SYS-003.
Invalid JSON on HTTP 300 or greater EK-EXTERNAL-000.

The SDK does not infer a universally safe retry from these names. See the PHP SDK, JavaScript SDK and diagnostic guide for the corresponding transport and recovery boundaries.

Extension constructors, plugin registration and user-provided adapters may propagate ordinary exceptions or caller-defined codes. The catalogue does not impose a new code on an arbitrary application failure.