Error codes

Each code says what happened and how to fix it. A thrown error stops your code. A failure is a value a function returns, and you decide what to do with it.

thrown stops your code unless you catch itfailure returned as a value for you to handle

135 codes in 12 packages

@arki/async 8 codes

CodeKindWhat happened
ARKI_ASYNC_E001thrownA wait is negative, `NaN`, not finite, or above {@link MAX_WAIT_MS}.
ARKI_ASYNC_E002thrownWork was cut short by its `AbortSignal` before it finished: a `sleep`, a `scoped` body, or an `all` / `mapConcurrent` / `race` / `timeout` call.
ARKI_ASYNC_E003thrownOne or more `scoped` finalizers threw.
ARKI_ASYNC_E004thrownA `timeout` deadline passed before the task finished.
ARKI_ASYNC_E005thrownA `concurrency` limit is not a positive integer or `Infinity`.
async.cancelledfailureOwned execution was cancelled; the external reason stays private.
async.deadlinefailureAn owned deadline elapsed; work still needs cooperative settlement.
async.scope_failedfailureMultiple owned failures; public counts serialize while original members stay private.

@arki/cli 6 codes

CodeKindWhat happened
cli.cancelledfailureThe run was interrupted by SIGINT or SIGTERM.
cli.confirmation_requiredfailureThe command asks for confirmation and there is no terminal to ask on.
cli.input_requiredfailureA required value is missing and there is no terminal to ask for it.
cli.invalid_inputfailureThe command line does not fit the command's input.
cli.preview_unsupportedfailure`--dry-run` on a command without `preview`.
cli.unknown_commandfailureThe command name is not one at this level.

@arki/clock 4 codes

CodeKindWhat happened
ARKI_CLOCK_E001thrown`MockClock.advance` or `advanceAsync` got a negative or non-finite number of milliseconds.
ARKI_CLOCK_E002thrown`setTimer` or `sleep` got a delay that is negative, not finite, or longer than a timer can hold.
ARKI_CLOCK_E003thrownLegacy abort exception code; sleep now returns SleepCancelled.
clock.sleep_cancelledfailureA sleep ended before its timer because its owner cancelled it.

@arki/contracts 13 codes

CodeKindWhat happened
ARKI_CONTRACTS_E001thrown`defineId` got a non-string prefix.
ARKI_CONTRACTS_E002thrown`assertUniqueIdPrefixes` found two prefixes that are equal or start one another.
ARKI_CONTRACTS_E003thrownReserved legacy exception code; ID generation now returns RandomSourceUnavailable.
ARKI_CONTRACTS_E004thrown`keyset` got no keys.
ARKI_CONTRACTS_E005thrownReserved legacy exception code; cursor decoding now returns InvalidCursor.
ARKI_CONTRACTS_E006thrownA contract key contains `.` or uses a reserved name.
ARKI_CONTRACTS_E007thrown`operationOf` got a value that carries no operation.
ARKI_CONTRACTS_E008thrownThe Drizzle column builder has no runtime config for its schema metadata.
ARKI_CONTRACTS_E009thrown`defineId` received a missing, empty or non-string domain kind.
ARKI_CONTRACTS_E010thrown`defineId` received an unsupported generation format.
contracts.invalid_cursorfailureA cursor cannot be decoded for this keyset.
contracts.invalid_cursor_valuefailureA row has a missing or unrepresentable cursor key.
contracts.random_source_unavailablefailureSecure ID generation has no usable Web Crypto provider.

@arki/dot 57 codes

CodeKindWhat happened
ARKI_DOT_E001thrownA `configure` hook attempted async work (returned a Promise).
ARKI_DOT_E002thrownA `configure` hook threw.
ARKI_DOT_E003thrownA `boot` hook threw.
ARKI_DOT_E004thrownA `start` hook threw.
ARKI_DOT_E005thrownOne or more `stop` hooks threw — aggregate.
ARKI_DOT_E006thrownOne or more `dispose` hooks threw — aggregate.
ARKI_DOT_E007thrownCaller tried to reuse the app after dispose.
ARKI_DOT_E008thrownCaller tried to reuse the app after a failed lifecycle.
ARKI_DOT_E011thrownPlugin registered twice.
ARKI_DOT_E012thrownA plugin's `needs` entry has no provider among earlier-booted plugins.
ARKI_DOT_E013thrownA plugin published a wire key that an earlier plugin already provides.
ARKI_DOT_E014thrownA needs alias, publish key, or rename target uses the reserved `$` prefix.
ARKI_DOT_E015thrownA lifecycle hook exceeded the app's `hookTimeoutMs` watchdog.
ARKI_DOT_E016thrownTwo actions in the same binding use the same id.
ARKI_DOT_E017thrownAction metadata is not JSON-round-trip safe.
ARKI_DOT_E018thrownMore than one plugin fills the logging slot.
ARKI_DOT_E019thrownStatic capability needs form a ring: a feature's need comes back around to itself.
ARKI_DOT_E020thrownA feature needs a capability whose (static) provider is mounted after it.
ARKI_DOT_E021thrown`$describeAction` named an action the calling plugin may not amend (unknown id, or not its own).
ARKI_DOT_E022thrownTwo routers of a feature use the same key.
ARKI_DOT_E023thrownTwo repos of a feature use the same key.
ARKI_DOT_E024thrownTwo slices of a feature use the same key.
ARKI_DOT_E025thrownA feature was declared with no slices.
ARKI_DOT_E026thrownA handle the feature needs is missing from the services bag.
ARKI_DOT_E027thrownA need alias, infra key, provided key or entrypoint key collides with another slot or a reserved name.
ARKI_DOT_E028thrown`override()` named a key that no infra plugin of the feature provides.
ARKI_DOT_E029thrown`routerFor()`: an app-contract key is implemented by zero or several features.
ARKI_DOT_E030thrown`routerFor()`: a feature's contract is not mounted in the app contract.
ARKI_DOT_E031thrown`rpc()`: a procedure's contract `meta` is not plain JSON, so `dot explain` cannot show it.
DOT_LOG_E001thrown`boot` ran before the kernel activated the logging slot.
dot.action_approval_requiredfailureApproval must be verified for this invocation, not inferred from another exposure.
dot.action_not_exposedfailureAn adapter may call only an explicitly exposed boundary.
dot.action_principal_requiredfailureThe adapter must authenticate its caller before invoking this action.
dot.app_import_failedfailureImporting the app file threw, or its exported factory did.
dot.app_invalid_exportfailureThe app file loaded, but no export is a DOT app, or several are and none is `default` or `app`.
dot.app_lifecycle_failedfailure`configure` threw while the CLI prepared the app.
dot.app_not_foundfailureNo app file at the default paths and no `--app`.
dot.dev_already_runningfailureAnother `dot dev` is alive in this project: its pid is in the state file.
dot.dev_app_startedfailureThe app export is already configured, booted or started: `dot dev` cannot own its lifecycle.
dot.dev_db_unreachablefailure`dot dev` found no Postgres to talk to: no URL, a bad URL, or a closed port it could not start.
dot.dev_port_in_usefailureSomething already listens on the app port, so the runner would not get it.
dot.dev_preflight_failedfailureThe preflight process did not report a result: a crash, a hang past the timeout, or output that is not its report.
dot.dev_remote_db_refusedfailureThe database is neither on this machine nor a compose service: `dot dev` would migrate it on boot.
dot.dev_runner_failedfailureThe app runner (`vite dev`, `--run`, or `dot _serve`) could not be started.
dot.doctor_failedfailure`doctor` found error-severity issues.
dot.lazy_closedfailureAn operation tried to initialize a service after its owner closed admission.
dot.observability_no_sdkfailure`doctor --observability` found no OpenTelemetry SDK.
dot.preflight_failedfailureA managed preflight reported a lifecycle failure, retaining the complete report.
dot.projection_conflictfailureTwo plugins register different modules for one projection format.
dot.projection_execution_failedfailure`project(manifest)` threw or returned output that does not survive a JSON round trip.
dot.projection_import_failedfailureThe projection module could not be resolved or imported, or exports no `project(manifest)`.
dot.projection_not_foundfailureNo plugin registers the `--as` format.
dot.runtime_release_failedfailurePrevious ownership could not be released, so starting another app is unsafe.
dot.runtime_replacedfailureA replaced module no longer owns the application's runtime.
dot.target_not_emptyfailure`dot new` would overwrite files in a non-empty target directory.
dot.template_missingfailureThe package's bundled template directory is empty or missing.
dot.write_failedfailure`dot new` could not write some files.

@arki/env 1 code

CodeKindWhat happened
ARKI_ENV_PLUGIN_E001thrownThe env failed its schema at boot.

@arki/failure 13 codes

CodeKindWhat happened
ARKI_FAILURE_E001thrown`defineFailure` got an empty code, or the reserved code `ok`.
ARKI_FAILURE_E002thrown`defineFailure` got a status that is not an integer from 400 to 599.
ARKI_FAILURE_E003thrown`match` met a failure code it has no handler for.
ARKI_FAILURE_E004thrown`unreachable` was reached, so a value the types said could not happen did happen (often bad data from outside).
ARKI_FAILURE_E005thrownTwo definitions with the same code were given where codes must be unique.
ARKI_FAILURE_E006thrown
ARKI_FAILURE_E007thrown
ARKI_FAILURE_E008thrownAn `invariant` condition was falsy, so code relied on something that is not true.
failure.invalid_envelopefailureAn external envelope cannot be trusted as a known failure.
failure.unexpected_defectfailureA caught operation defect, distinct from the UnexpectedFailure exception bridge.
schema.async_requiredfailureA synchronous operation received an asynchronous validator result.
schema.invalid_inputfailureInput failed the schema's checks.
schema.validator_defectfailureA validator threw, rejected, or violated the Standard Schema result contract.

@arki/log 5 codes

CodeKindWhat happened
ARKI_LOG_E001thrown`configure()` ran a second time on the same logging instance.
ARKI_LOG_E002thrownA category rule or `to()` names a channel that `configure({ channels })` does not define.
ARKI_LOG_E003thrownA level is neither one of the six names nor a severity number from 1 to 24.
ARKI_LOG_E004thrown`fakeLog()` ran while another fake was active, or `configure()` ran while a fake owns the instance.
ARKI_LOG_E005thrown`reconfigure()` was called on a handle that no longer owns the configuration.

@arki/math 11 codes

CodeKindWhat happened
ARKI_MATH_E001thrownA string is not a number in the accepted syntax.
ARKI_MATH_E002thrownAn argument is outside what the function accepts.
ARKI_MATH_E003thrownDivision by zero, or zero raised to a negative power.
ARKI_MATH_E004thrownThe exact result needs rounding and no rounding mode was given.
ARKI_MATH_E005thrownA value cannot be represented in the target type.
ARKI_MATH_E006thrownA statistic was asked of an empty or too small data set.
ARKI_MATH_E007thrownAn input or result exceeds the documented digit limits.
ARKI_MATH_E008thrownThe runtime lacks an `Intl` feature this call depends on.
ARKI_MATH_E009thrownA matrix is singular to working precision.
ARKI_MATH_E010thrownAn iterative method did not reach its tolerance.
ARKI_MATH_E011thrownA matrix that must be symmetric positive definite is not.

@arki/resilience 7 codes

CodeKindWhat happened
ARKI_RESILIENCE_E001thrownThe circuit breaker is open and rejected the call.
ARKI_RESILIENCE_E002thrownA timeout policy reached its deadline.
ARKI_RESILIENCE_E003thrownThe caller's own signal aborted the call.
ARKI_RESILIENCE_E004thrownA bulkhead had no free execution or queue slot.
ARKI_RESILIENCE_E005thrownEvery retry attempt failed.
ARKI_RESILIENCE_E006thrownA `backoff` builder got an option or an attempt number it cannot use.
ARKI_RESILIENCE_PLUGIN_E001thrown`for` or `run` got a name that is not in the presets (only reachable from untyped JS).

@arki/schema 3 codes

CodeKindWhat happened
ARKI_SCHEMA_E003thrownA `withJsonSchema` converter was asked for a target other than draft-2020-12.
ARKI_SCHEMA_E004thrown`assert` or `ensure` got a value the schema rejects.
ARKI_SCHEMA_E005thrown`is`, `assert` or `ensure` got a schema that validates asynchronously.

@arki/string 7 codes

CodeKindWhat happened
ARKI_STRING_E001thrownAn argument is outside what the function accepts (empty needle, negative length, bad glyph).
ARKI_STRING_E002thrownText or bytes are not valid UTF-8: an unpaired surrogate, an overlong form, a bad lead byte.
ARKI_STRING_E003thrownAn input is not valid strict base64: whitespace, a mixed alphabet, bad padding or an impossible length.
ARKI_STRING_E004thrownAn `interpolate` template has a malformed placeholder.
ARKI_STRING_E005thrownAn `interpolate` placeholder has no value and `missing` is `'throw'`.
string.invalid_base64failureNoncanonical base64.
string.invalid_utf8failureInvalid UTF-8.