Skip to main content

Error codes

When a call fails, the package returns {ok: false, error: '<code>'} (or the raw bridge returns {success: false, error: '<code>'}). Never show the raw code to the player — translate it to a friendly message.

CodeMeaningWhat to do
insufficient_coinsPlayer doesn't have enoughShow a "need X more coins" message
invalid_amountAmount ≤ 0, non-integer, or over the capFix the call site
invalid_reasonReason failed the regex / length checkUse [a-z0-9_]+, ≤ 64 chars
invalid_datasaveProgress data wasn't a JSON objectPass a plain object
data_too_largesaveProgress payload > 100 KBCompact your state; don't retry
serialization_errorSave data wasn't JSON-serialisableRemove functions / circular refs
save_failedBackend rejected the saveTransient — retry with backoff
rate_limitedToo many calls / earn cap hitBack off and retry later
forbiddenCall wasn't for the signed-in playerDon't pass user ids; let the app own identity
user_not_foundNo authenticated userFall back to offline mode
network_errorRequest to the backend failedTransient — retry with backoff
internal_errorUnexpected bridge errorReport to the Gamma team
dispatch_errorBridge transport failed to sendTreat as network_error
empty_responseBridge returned nothingTreat as network_error
timeoutBridge didn't respond in 30 sTreat as network_error
unknown_typeUnknown message type (SDK/app mismatch)Update your SDK / check the call
no_transportRunning outside the app, mock disabledUse isInApp and an offline path
type GammaErrorCode =
| 'insufficient_coins' | 'invalid_amount' | 'invalid_reason'
| 'invalid_data' | 'data_too_large' | 'serialization_error'
| 'save_failed' | 'rate_limited' | 'forbidden'
| 'user_not_found' | 'network_error' | 'internal_error'
| 'dispatch_error' | 'empty_response'
| 'timeout' | 'unknown_type' | 'no_transport';
Ask:View .md