Skip to content
esc

Search pages and sections. Try a tool name, an error code, a route.

↑↓ navigate↵ openesc close

SDK · @manybases/js

@manybases/js — errors

Nothing is thrown. Every call returns a Result: { data, error }, and lists add cursor.

ts
const { data, error } = await mb.from("habits").insert({ name: "Run" });
if (error) {
  console.error(error.status, error.code, error.message);
  console.error(error.hint);       // what to do next
  console.error(error.requestId);  // the id to find the call in the Logs screen
}

error is a ManybasesError — an Error subclass that the SDK never throws — with:

FieldMeaning
statusThe HTTP status. 0 means the server never answered: network, DNS, or a cross-origin request the browser blocked
codeOne of the API's seventeen codes — see Errors
messageWhat happened
hintWhat to do next, written for a program to act on
requestIdThe request id, from the body of a 5xx or the X-Request-Id header otherwise
retryAfterSeconds to wait, from the Retry-After header of a 429
confirmationToken, willDestroyOn a 428 only: the token to re-send, and the summary of what the gesture would do

A successful Result also carries replayed: true when the response came from the idempotency store — nothing was recreated.

Codes you will meet from an app#

  • 401 unauthorized — no session where one is needed, or a publishable key that is unknown, revoked or replaced by a rotation.
  • 402 quota_exceeded — the seat cap at a sign-up, the account's storage or request quota, or a project in read-only mode: every write answers this until the account is back under its plan.
  • 403 forbidden — a write the preset does not allow on a row the caller can see, such as editing a journal row.
  • 404 not_found — the table or row does not exist, or the caller may not see it; the two are indistinguishable.
  • 409 conflict — a replayed idempotency key with a different body, or a replay by a visitor without a session.
  • 413 payload_too_large — a row above 64 KB, a file above 25 MB, a body above 256 KB.
  • 429 rate_limited — the project's 300 requests per minute, shared by every visitor holding the same publishable key; or, on sendMagicLink, 20 requests an hour from one IP, or today's sign-in emails used up. Wait retryAfter seconds.

The SDK never retries on its own: for a visitor with no session, a retried POST would turn a successful submission into a 409.