Files
aji/docs/reference/error-codes.md
T
dev b82bc35c5f spec: accept RFC 0012 and integrate waits, channels, select and mutex
revision 2 per owner review: reserved-feature dependencies may change
until publication (general rule, DD-014); task.join.cancel returns the
handle on cancelled with loans still LOANED; channel.sender.dup from
ref<sender<T>> (MPSC, receiver_dup reserved); task.wait required by
every suspending operation, task.join included, only in modules
declaring cancellation; sent values and handles come back as block
parameters on closed/cancelled edges; explicit channel states

spec 04 §37-§41 and pointers in §11-§16, §35, §36; spec 05 §9, 07
§8.11, 07a, 08 §14, 11 §6-§7; features cancellation, channels, sync
published (implementation pending); rwlock, channel_transfer,
receiver_dup, guard_transfer reserved; effect task.wait; E4304, E4305;
Q-013 resolved; bundle +15.8 % tokens (recorded)
2026-10-04 16:27:38 +03:00

96 lines
4.7 KiB
Markdown

# Error Code Registry
Draft registry. Codes are stable once released in a tagged compiler version.
## E0xxx — AIR text and module
| Code | Kind | Meaning |
|---|---|---|
| E0001 | parse.unexpected_token | Token not allowed by the text AIR grammar here |
| E0002 | parse.invalid_literal | Literal malformed or not representable in its type |
| E0003 | parse.duplicate_name | Function, type, block, field or variant name defined twice |
| E0004 | parse.unknown_name | Unknown opcode, type, function, field or variant |
| E0005 | module.unsupported_version | AIR format or language version not implemented |
| E0006 | module.unsupported_feature | Feature unknown, unsupported, undeclared or dependency-incomplete, or reserved type used; field `reason` (reference/air-features.md) |
## E1xxx — Types and values
| Code | Kind | Meaning |
|---|---|---|
| E1001 | type.mismatch | Operand/result type mismatch |
| E1002 | type.invalid_cast | Cast not permitted by safe semantics |
| E1003 | type.recursive | Aggregate type contains itself by value |
| E1010 | init.read_uninitialized | Read from uninitialized storage |
## E2xxx — Memory and ownership
| Code | Kind | Meaning |
|---|---|---|
| E2001 | ownership.use_after_move | Value used after ownership transfer |
| E2002 | ownership.double_consume | Linear value consumed twice |
| E2101 | borrow.mutable_alias | Overlapping exclusive/shared borrow violation |
| E2102 | borrow.outlives_owner | Borrow may outlive backing storage |
| E2103 | memory.out_of_bounds | Access not proven in bounds |
| E2104 | memory.region_generation | Reference belongs to invalidated region generation |
| E2110 | island.escape | Island-internal reference escapes island |
| E2105 | borrow.not_ended | Owned borrow live at `ret`, or borrow state differs between edges into a block |
| E2106 | borrow.use_after_end | Borrow used or ended after it was ended |
| E2107 | borrow.not_owned | Lent (parameter) borrow ended by the callee |
| E2108 | borrow.escapes_frame | Borrow derived from frame storage returned from its function |
| E2111 | island.foreign_mutable_edge | Island graph points to forbidden foreign mutable storage |
## E3xxx — Resources/capabilities/effects
| Code | Kind | Meaning |
|---|---|---|
| E3001 | resource.use_after_consume | Closed/joined/released resource reused |
| E3002 | resource.leak | Linear resource has no terminal consumption path |
| E3101 | effect.undeclared | Callee effect absent from caller contract |
| E3201 | capability.missing | Required authority unavailable |
| E3202 | capability.widen | Attempt to widen delegated authority |
## E4xxx — Concurrency
| Code | Kind | Meaning |
|---|---|---|
| E4001 | concurrency.not_send | Non-Send value moved to migratable task/thread |
| E4002 | concurrency.not_share | Non-Share value concurrently shared |
| E4101 | concurrency.possible_data_race | Conflicting ordinary access not ordered/synchronized |
| E4201 | atomic.invalid_order | Memory ordering invalid for atomic operation |
| E4301 | task.live_child_escape | Scope exits with live child task |
| E4302 | task.borrow_escape | Child task borrow can outlive parent storage |
| E4303 | io.buffer_in_flight | Buffer accessed while async operation owns/borrows it |
| E4304 | sync.wait_while_locked | Suspending operation, spawn, or call of a waiting/spawning function while a lock guard is live |
| E4305 | task.shield_order | Shield ended while a more inner shield is live |
## E5xxx — AIR/verifier
| Code | Kind | Meaning |
|---|---|---|
| E5001 | air.invalid_ssa | SSA definition/dominance failure |
| E5002 | air.invalid_cfg | Invalid block/terminator structure |
| E5101 | verifier.resource_limit | Deterministic verifier resource limit exceeded |
## E6xxx — Unsafe/ABI
| Code | Kind | Meaning |
|---|---|---|
| E6001 | unsafe.required | Operation requires explicit unsafe boundary; field `reason`: `outside_boundary`, `trusted_declares_unsafe` |
| E6101 | abi.unaligned_reference | Normal reference requested from insufficiently aligned storage |
## T0xxx — Runtime traps
Reported in trap records (spec 01 §6), not by the verifier.
| Code | Kind | Meaning |
|---|---|---|
| T0001 | trap.explicit | `trap` instruction executed |
| T0002 | trap.assert | Assertion failed |
| T0003 | trap.overflow | Checked arithmetic result not representable |
| T0004 | trap.division_by_zero | Division or remainder by zero |
| T0005 | trap.shift_out_of_range | Shift amount negative or not less than bit width |
| T0006 | trap.cast_out_of_range | Checked cast value not representable in target type |
| T0007 | trap.call_depth | Call depth limit (1 024 frames) exceeded |
| T0008 | trap.out_of_bounds | Runtime bounds check failed |
| T0009 | trap.unsafe_precondition | Unsafe precondition violated (detected) |