Skip to content
Verified

Error codes

Every negative code and HTTP status in the CPI error catalog, what it means, and what to do.

Xuda keeps one catalog of every error a call can come back with. This page is that catalog, organized by where the error shows up. See Errors for the API-specific framing of the same codes.

HTTP status errors

These are the statuses you see at the transport layer, whether you hit a page directly or a cpi call.

Client-contract codes

The dashboard's own client recognizes these and drives a specific UI flow off them rather than a generic error message. Billing moved from a prepaid balance to postpaid invoicing, so the only gates left on a paid action are a missing card and a past-due invoice. -92 (negative balance) and -93 (top-up required) are gone from the account gate that used to throw them; a -93 handler still exists in the client for compatibility, it just has nothing left to trigger it.

The response envelope

Every method, success or failure, answers { code, data }. code >= 1 is success; code < 0 is an error. Some HTTP-layer errors add a string error key alongside the numeric code ("rate_limited", "invalid_fields", "appeal_failed"), sometimes with a fields: [] array.

CPI maps a negative code to an HTTP status with one rule: a code from -400 to -499 becomes that exact status (-400 itself answers HTTP 400, -404 answers HTTP 404, -409 answers HTTP 409, -428 answers HTTP 428). Every other negative code, -1, -500, -762, -999, anything outside that one band, also answers a plain HTTP 400. A handful of separate, narrower endpoints (a few storefront checkout and public-form routes, not the general /cpi/<method> dispatch) map only -404/-403/-400 and default everything else to 422 instead; that map is local to those routes and does not describe the general rule above, so a -400 from the general dispatch is HTTP 400, not 422.

The same number is reused across methods with different meanings, especially -1 and -400. Always read the data message and the method you called; the meanings below are the common case, not a guarantee.

CPI negative codes

The codes worth branching on, gathered from a scan of every cpi/*_module.

Beyond this table, individual modules use small negative codes (roughly -2 through -25, -44/-45/-46, -64 through -78, -99/-101/-106) for module-specific intermediate states. These are almost always paired with a descriptive data message, often err.message. When you hit one, read the data string and the originating method rather than relying on the number alone.

Internal / undeclared errors

A handful of failures never reach the { code, data } envelope at all: an uncaught exception, an unhandled promise rejection, a throw new Error(...) that surfaces as a bare 401 or 500 (for example 'app is off', 'Account suspended', 'Account terminated'), or a message-broker failure. These are detected by shape or source rather than by a fixed code, and they are always worth escalating rather than retrying blindly.