Errors
Everything throws — there are no error-shaped return values:GoliathOperationError is the one to handle in normal application flow — it
means the gateway accepted and ran your call, but the operation itself
reported errors.
Retries (built in)
- Both
429s are pre-execution rejections — retried for any operation, honoringRetry-Afterexactly. - Network errors, timeouts, and
5xxs are retried only when a re-send cannot double-fire a side effect: queries, or mutations sent with anidempotencyKey. - A mutation without an idempotency key is never re-sent.
- Backoff is exponential with full jitter: 500ms base, 8s cap.
Idempotency
Every mutation acceptsoptions.idempotencyKey:
idempotencyKey to a read is a compile error,
matching the 400 the gateway returns at runtime.
The key is any string of 1-255 characters (a UUID is the obvious choice). The
gateway reserves it before executing and stores the response when the request
completes; keys expire after 24 hours.
Detecting replaysWhen a retried write was already executed, the gateway replays the stored
response instead of re-running it. Replays surface through the
onMeta
callback (meta.replayed === true) — including replays whose stored body
carries errors.When a key is handed backA failure that provably happened before the write took effect — bad
variables, an invalid phone number, a Do-Not-Contact block — releases the key,
so you can correct the request and retry with the same one. A key whose
original request is still in flight returns
GoliathIdempotencyConflictError (409): retry shortly with the same key to
pick up its stored result.