AlmondTill/G3N API

Errors and retries

A refusal is never a bare status code. It is a structured object on the answer's errors list, with a class, a code inside the class, a retry verdict and words you can show. This guide is the grammar and the one retry rule.

The shape

json
{
  "data": null,
  "errors": [
    {
      "message": "That record could not be found.",
      "extensions": {
        "major": "NOT_FOUND",
        "minor": "CONSTRUCT",
        "retryable": false,
        "severity": "needs_decision",
        "why": "No record with that reference exists in this organization.",
        "next": "It may have been removed, or it is outside this organization."
      }
    }
  ],
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Each refusal has two parts. message is the refusal in plain words. extensions carries the code: major names the class, minor the code inside it, and retryable says whether what you asked for can still succeed. detail appears there when the refusal has more to say. severity, why and next appear there when the platform has words for the code: how serious it is, why it happened, and what to do. Read the code from extensions — the error itself carries message only. The answer still carries extensions.at with its callId — quote it when a refusal needs a look.

The 12 classes

VALIDATION · AUTHN · AUTHZ · NOT_FOUND · CONFLICT · RATE_LIMIT · PAYMENT · FULFILLMENT · TAX · FISCAL · INTEGRATION · INTERNAL — 113 codes in all, every one on the errors pages with what happened, why, what to do, and whether to retry.

Four codes every call can answer

Beyond the four: an operation that takes an id can answer NOT_FOUND; a change can answer CONFLICT — the record's state, or an edit made in the meantime, does not allow it — and VALIDATION/VERSION_REQUIRED when the envelope named no version. Each operation page lists exactly the codes it can answer.

The one retry rule

retryable says whether the refusal is final. When it is false, the call cannot succeed as it stands. Change something first: the values, the record's state, or who is calling. Retrying a false refusal unchanged only repeats it.

When it is true, what you asked for can still succeed, after the thing the refusal names has changed. next says what that is. There are three kinds:

No answer is not a refusal

A call can end with no answer: a timeout, or a dropped connection. You then do not know whether the change landed. Read first. Send the change again only when the read shows it did not land. A create that landed and is sent again can make a second record.

Sign-in refusals say one thing

A failed key exchange answers AUTHN/LOGIN_FAILED whatever the cause: an unknown, expired or retired key, and an organization the key does not reach, all read the same. Nothing leaks about which keys exist, so do not branch on the cause — check the secret and the organization, and mint a new key if in doubt.

Every code's verdict

The retry verdict of every code, as the platform answers it — the same table the errors pages carry, in one place:

CodeRetryWhat happened
VALIDATION/INVALIDnoSomething in the request is not valid.
VALIDATION/UNKNOWN_FIELDnoThe request named a field this system does not recognize.
VALIDATION/VERSION_MISMATCHnoThe app version does not match the server.
VALIDATION/VERSION_DISCONTINUEDnoThis app version is no longer supported.
VALIDATION/VERSION_REQUIREDnoThe request did not say which app version it came from.
VALIDATION/EMPTY_SCOPEnoThe selection matched nothing to count.
VALIDATION/UNSUPPORTEDnoThat option is recognized but not available yet.
VALIDATION/UNSUPPORTED_CURRENCYnoThat currency is not supported for selling yet.
VALIDATION/CURRENCY_NOT_ALLOWEDnoThat currency is not in the organization’s allowed list.
VALIDATION/DRY_RUN_UNSUPPORTEDnoThis operation cannot be tried dry.
VALIDATION/IDENTITYnoThe subject identity could not be verified.
VALIDATION/COUPON_INELIGIBLEnoThis coupon does not apply to this order.
AUTHN/REQUIREDnoSign in to do this.
AUTHN/SESSION_EXPIREDnoYour session has ended.
AUTHN/LOGIN_FAILEDnoThe sign-in was not accepted.
AUTHN/DEVICE_SESSION_INVALIDnoThis device is no longer signed in or registered.
AUTHZ/FORBIDDENnoYour role does not allow this action.
AUTHZ/APPROVAL_REQUIREDnoThis action needs approval.
AUTHZ/INSUFFICIENTnoApproving this needs a higher authority level than yours.
AUTHZ/SELF_APPROVALnoYou cannot approve your own request.
AUTHZ/INVALID_PAIRINGnoThat pairing code was not accepted.
AUTHZ/PAIRING_EXPIREDyesThat pairing code has expired.
NOT_FOUND/CONSTRUCTnoThat record could not be found.
NOT_FOUND/IDENTIFIERnoNothing matches that identifier.
NOT_FOUND/BOOKMARKnoThat bookmark no longer exists.
NOT_FOUND/REACTIONnoThat reaction is not yours to remove.
NOT_FOUND/APPDATAnoThat saved setting does not exist.
NOT_FOUND/MESSAGEnoThat message could not be found in your inbox.
NOT_FOUND/NOTIFICATIONnoThat notice could not be found.
NOT_FOUND/MAILnoNo mail sent to you answers that reference.
NOT_FOUND/COUPONnoNo active coupon matches that code.
CONFLICT/FSM_TRANSITION_INVALIDnoThe record is in a status that does not allow that change.
CONFLICT/IMMUTABLEnoThat part of the record can never be changed.
CONFLICT/REFERENCEDnoOther records still point at this one.
CONFLICT/INCOMPLETEyesThe work is not finished yet.
CONFLICT/REF_STATEnoA record this depends on is not in a usable state.
CONFLICT/REVISION_STALEyesSomeone else changed this record while you were working.
CONFLICT/RECONCILEyesThe system is reconciling this record.
CONFLICT/IDENTITY_TAKENnoThat value is already used by another record.
CONFLICT/UNSELECTEDnoThis organization has not selected that catalog item.
CONFLICT/CURRENCY_FLOORnoThis change would leave products without a price in the organization currency.
CONFLICT/SKU_TAKENnoThat SKU has already been used and can never be reused.
CONFLICT/PRICE_WINDOW_OVERLAPnoThe dates overlap an already-scheduled price.
CONFLICT/RATE_WINDOW_OVERLAPnoThe dates overlap an already-scheduled tax rate.
CONFLICT/INSUFFICIENT_STOCKnoThere is not enough stock at that location for this move.
CONFLICT/DISCREPANCYnoThe received quantities do not match what was shipped.
CONFLICT/IN_PROGRESSnoSomething else is already in progress on this record.
CONFLICT/REJECTEDnoThe approval for this was rejected.
CONFLICT/UNRESOLVEDnoAn open discrepancy must be resolved before this can complete.
CONFLICT/NO_SOURCEyesNo location is available to source this from.
CONFLICT/SOURCING_FAILEDyesThe sourcing step could not complete.
CONFLICT/VARIANCE_REVIEWnoThe count variance is over the review threshold.
CONFLICT/THREE_WAY_MATCHnoThe received quantity exceeds what the purchase order allows.
CONFLICT/CREDIT_MISMATCHyesThe recorded vendor credit does not match the expected amount.
CONFLICT/EXPIREDnoAn attached document is outside its validity window.
CONFLICT/UNSETTLEDnoThere is an outstanding balance on this.
CONFLICT/RECOGNIZEDnoThis invoice already has recognized revenue.
CONFLICT/SETTLEDnoThe amount on this note has already settled.
CONFLICT/SAGA_LOCKEDyesAnother operation is holding this record.
CONFLICT/SEARCH_JOB_ACTIVEyesA search is already running for this session.
CONFLICT/EXPORT_JOB_ACTIVEyesAn export is already running for this session.
CONFLICT/FILL_DRAFT_ACTIVEyesA draft is already being made for you.
CONFLICT/STEP_FAILEDnoA step in this operation failed and it is being rolled back.
CONFLICT/OVER_RETURNABLEnoThe return quantity exceeds what is left to return on this order line.
CONFLICT/NOT_RETURNABLEnoThat order line is marked final sale or non-returnable.
CONFLICT/OVER_SHORT_REVIEWnoThe till over/short amount is over the review threshold.
CONFLICT/DOUBLE_BOOKEDnoThat time is fully booked on a requested resource.
CONFLICT/OVER_TENDEREDnoThe amount exceeds what this order can take.
CONFLICT/TENDEREDnoMoney is already held on this order.
CONFLICT/FX_WINDOW_OVERLAPnoThe dates overlap an already-scheduled exchange rate.
CONFLICT/POLICY_WINDOW_OVERLAPnoThe dates overlap an already-scheduled policy value.
CONFLICT/NO_EFFECTIVE_RATEyesNo exchange rate covers that currency pair right now.
CONFLICT/BACKORDERyesThere is not enough stock available to start picking.
CONFLICT/PACK_VERIFYnoPack verification did not pass.
CONFLICT/COUPON_CODE_TAKENnoAnother active coupon already uses that code.
CONFLICT/COUPON_EXPIREDnoThat coupon is outside its validity window.
CONFLICT/BOOKMARK_EXISTSnoThis is already bookmarked.
CONFLICT/REACTION_EXISTSnoYou already reacted with that emoji on this note.
CONFLICT/BOOKMARK_CAPnoYou have reached the bookmark limit.
CONFLICT/TRAINING_CAPnoThis training limit has been reached.
CONFLICT/TRAINING_ATTEMPT_OPENnoYou already have an open sitting for this course.
CONFLICT/TRAINING_TOO_FEW_QUESTIONSnoThis course has too few questions to test yet.
CONFLICT/TRAINING_PRACTICE_NOT_OPENnoNo practice is open for this course.
CONFLICT/APPDATA_CAPnoThis app has reached its saved-settings limit.
CONFLICT/COUPON_EXHAUSTEDnoThat coupon has reached its redemption limit.
CONFLICT/INSTRUMENT_CODE_TAKENnoThat code has already been used by a gift card or credit and can never be reused.
CONFLICT/NOT_RELOADABLEnoThat instrument cannot be reloaded.
CONFLICT/INSUFFICIENT_BALANCEnoThe amount exceeds the available balance.
CONFLICT/BALANCE_OUTSTANDINGnoThere is still a balance on this.
CONFLICT/INSUFFICIENT_POINTSnoThe member does not have enough points for that.
CONFLICT/MEMBER_EXISTSnoThat email is already enrolled in this program.
CONFLICT/REFERRAL_CODE_TAKENnoAn active affiliate already uses that referral code.
CONFLICT/LIST_PRICE_WINDOW_OVERLAPnoThe dates overlap an already-scheduled price list entry.
CONFLICT/CREDIT_LIMITnoThis charge would exceed the customer credit limit.
CONFLICT/ORDER_MINIMUMnoThe order is below this customer minimum order value.
CONFLICT/INSUFFICIENT_AR_BALANCEnoThe amount exceeds the customer outstanding balance.
CONFLICT/ERASE_FAILEDyesThe erasure could not finish in one go — the customer is not yet marked erased.
PAYMENT/AUTH_DECLINEDyesThe payment was declined.
PAYMENT/CAPTURE_FAILEDyesThe payment capture failed but the authorization still stands.
PAYMENT/SETTLEMENT_FAILEDyesThe payment is captured and safe, but settlement did not reconcile.
PAYMENT/REFUND_FAILEDyesThe refund could not be processed.
PAYMENT/READER_UNAVAILABLEyesThe card reader is busy or offline.
FULFILLMENT/FAILEDyesThe fulfillment step could not complete.
RATE_LIMIT/THROTTLEDyesToo many requests in a short time.
RATE_LIMIT/LOGIN_LOCKEDyesToo many failed sign-in attempts.
INTEGRATION/UNAVAILABLEyesAn outside service is temporarily unavailable.
INTEGRATION/TIMEOUTyesAn outside service did not answer in time.
INTEGRATION/REPLY_TOO_LONGnoThe reply ran past the length one request may carry.
FISCAL/CLEARANCE_FAILEDnoThe tax authority declined to authorize this sale.
FISCAL/CLEARANCE_TIMEOUTyesThe tax authority did not answer in time.
FISCAL/REGIME_UNCONFIGUREDnoNo certified fiscal provider is configured for this regime.
INTERNAL/UNEXPECTEDnoAn unexpected error occurred.
INTERNAL/WALLnoThis request took longer than the service allows.