Skip to content
v2.7

Errors

OwbaseException, the code and type fields, and the most common errors.

When the API rejects a request, the SDK throws OwbaseException with:

  • code: the HTTP status (400, 401, 404, 409, 429…);
  • type: the reason, as stable text (user_invalid_credentials). Decide based on type, not on the message;
  • message: the explanation, for logging. See Message language;
  • response: the raw response body.
erros.ts
import { Account, OwbaseException } from '@owbase/web';
import { client } from './client';
const account = new Account(client);
try {
await account.createEmailPasswordSession({ email: '[email protected]', password: 'wrong-password' });
} catch (e) {
if (!(e instanceof OwbaseException)) throw e;
// code: HTTP status. type: stable reason, good for deciding what to show.
if (e.type === 'user_invalid_credentials') console.log('Incorrect email or password.');
else if (e.code === 429) console.log('Too many attempts. Wait a moment and try again.');
else console.log(`Error ${e.code} (${e.type}): ${e.message}`);
}
type code When
general_argument_invalid 400 A parameter is missing or in the wrong format.
owbase_project_mismatch 400 The request carries project (or, in the S3 API, X-Amz-Credential) in a query with more than 1000 parameters, beyond what the server reads, and no X-Owbase-Project header. The SDKs send the header; when calling the API directly, send it and keep the project out of the body and the query.
user_invalid_credentials 401 Wrong email or password.
user_unauthorized 401 There’s a session, but the user doesn’t have permission on the resource.
general_unauthorized_scope 401 The API key doesn’t have the method’s scope, or there’s no session and the method requires a signed-in user (for example, account.get()).
owbase_billing_suspended 402 The project’s organization is suspended for non-payment (payment).
owbase_billing_card_required 402 The project’s organization is waiting for its card to be confirmed: its projects stay closed until the Owner resolves the situation in the console.
owbase_billing_expired 402 The project’s organization expired without a confirmed card: its projects stay closed until the Owner resolves the situation in the console.
owbase_quota_exceeded 402 The organization’s projects are paused because usage reached a plan quota (requests, bandwidth or storage; Starter and Pro). The Owner upgrades the plan under Billing and the projects reopen. The console still opens the project (near the limit).
general_unknown_origin 403 The app’s domain isn’t under Platforms.
owbase_org_create_via_signup 403 Creating an organization directly through the console API is not allowed: only the platform owner creates organizations there.
owbase_account_blocked 403 The console account was blocked by the platform. Contact support.
project_not_found 404 Wrong project ID.
row_not_found 404 The row doesn’t exist (or the user can’t read it).
user_already_exists 409 An account with that email or ID already exists.
row_already_exists 409 A row with that ID already exists.
general_rate_limit_exceeded 429 Too many attempts: wait and try again.

Owbase’s own routes (/_owbase/...) use English names: route, fields, values and error codes. In these areas, the type of the errors starts with:

Area type starts with Examples
Import and export owbase_data_ owbase_data_task_not_found, owbase_data_deletion_blocked, owbase_data_deletion_scheduled
Billing owbase_billing_ owbase_billing_unavailable, owbase_billing_payment_declined, owbase_billing_nothing_to_pay, owbase_billing_invalid_coupon
Organization usage owbase_billing_usage_ owbase_billing_usage_month_not_found
Invitations owbase_invite_ owbase_invite_invalid, owbase_invite_unavailable, owbase_invite_wrong_account
Password recovery owbase_recovery_ owbase_recovery_invalid
Audit log owbase_audit_ owbase_audit_invalid, owbase_audit_unavailable, owbase_audit_export_not_found
Access requests owbase_access_ owbase_access_not_found, owbase_access_answered
Notifications owbase_notifications_ owbase_notifications_invalid, owbase_notifications_unavailable

The earlier Portuguese routes (such as /_owbase/dados/* and /_owbase/sms/envios) keep working and keep returning the codes they always did (owbase_dados_*, owbase_cobranca_*, owbase_convite_*…). When you move an integration to the English routes, compare type with the English code.

The message of Owbase errors comes in English (default) or Portuguese, depending on the request. The language is chosen in this order:

  1. client.setLocale(...), which the SDK sends on every request in the X-Owbase-Locale header;
  2. the request’s Accept-Language (the browser’s, with @owbase/web);
  3. English, when there is neither.

Values starting with en (en, en-US) ask for English; those starting with pt (pt, pt-BR) ask for Portuguese. Any other language is ignored and falls to the next step.

web/idioma.ts
import { Client } from '@owbase/web';
// Owbase errors (the `message`) come in English; without setLocale, the browser's Accept-Language applies and, lastly, Portuguese.
// To decide what to do, always use e.type, never the message text.
export const client = new Client().setEndpoint('https://cloud.owbase.dev/v1').setProject('<PROJECT_ID>').setLocale('en');
node/idioma.ts
import { Client } from '@owbase/node';
// Owbase errors (the `message`) come in English; without setLocale, Portuguese applies.
// To decide what to do, always use e.type, never the message text.
export const client = new Client()
.setEndpoint('https://cloud.owbase.dev/v1')
.setProject('<PROJECT_ID>')
.setKey(process.env.OWBASE_API_KEY ?? '')
.setLocale('en');

setLocale exists in @owbase/web 1.1.0 and in @owbase/node 2.0.0 or newer.

The same language applies to the files Owbase generates on request, such as the rejected-rows file of an import (see how it looks).

Was this page helpful?