Skip to content

Search is only available in production builds. Try building and previewing the site to test it out locally.

Errors

Every error, from the API and from the CLI, has a machine code, a human message, the guilty field when there is one, a documentation URL, and, from the CLI, a fix: one sentence that says what to do next.

{ "ok": false, "environment": "test",
"error": {
"code": "slot_unavailable",
"message": "The requested slot is no longer available. 1 unit requested, 0 available.",
"param": "start",
"doc_url": "https://bookrail.dev/docs/errors#slot_unavailable",
"fix": "The capacity is gone. Run `bookrail availability --service ... --explain` to see what took it.",
"request_id": "req_..."
} }
CodeMeaning
0Success
1User or configuration error. Re-running the same command fails the same way.
2Authentication or permission.
3Network, timeout, rate limit or server fault. Retrying later may work.
4Conflict: the state changed underneath. Retrying may work right now.

invalid_request (400), authentication (401), permission (403), not_found (404), conflict (409), rate_limit (429), policy_violation (422), payment_required (402), internal (500).

CodeTypeWhen
missing_api_key, invalid_api_key, revoked_api_keyauthenticationNo key, a malformed one, or one that was revoked.
live_key_without_liveauthentication (CLI)A sk_live_ key is configured and --live was not typed. Nothing was sent.
parameter_missing, parameter_invalid, invalid_bodyinvalid_requestThe request body.
resource_missingnot_foundAn id that does not exist in this project and environment.
slot_unavailableconflictThe capacity is gone. The message carries the units requested and available.
hold_expired, hold_not_activeconflictThe hold died or was already used.
serialization_failureconflictNothing was written. Run the command again.
idempotency_key_in_progressconflictAnother request with the same key is still running.
idempotency_key_reusedinvalid_requestThe same key was used for a different request.
start_not_on_gridpolicy_violationThe instant is not on the slot grid of the service.
min_notice_violated, outside_booking_windowpolicy_violationThe booking window of the service.
customer_limit_reachedpolicy_violationmaxActiveBookingsPerCustomer is reached.
duration_not_offeredinvalid_requestNot one of the service’s durations.
resource_not_eligibleinvalid_requestA forced resource is not a candidate of any requirement.
invalid_transitionconflictThe booking’s state does not allow that action.
no_show_too_early, complete_too_earlypolicy_violationToo early for that transition.
max_reschedules_reachedpolicy_violationThe policy’s limit.
range_too_large, invalid_range, timezone_missinginvalid_requestAvailability requests.
invalid_webhook_urlinvalid_requestNot public, or http on live.

Two codes that people expect and that do not exist: capacity_exceeded (a quantity above capacity is slot_unavailable, whose message is more precise) and schedule_conflict (a calendar change that invalidates a future booking is not an error: it emits a booking.orphaned event and leaves the booking alone).

CodeMeaning
config_not_foundNo bookrail.config.* in the working directory.
invalid_configThe file parsed but does not validate. The message lists each position.
config_unreadableThe file could not be evaluated. Usually a TypeScript config on a Node without a TypeScript loader.
confirmation_requiredThe command would delete something and --yes was not given.
ambiguous_config_idTwo remote objects carry the same metadata.config_id.
missing_inputA required value was not given and there was no terminal to ask on.
network_error, timeoutThe API could not be reached.