Reference

Errors

When the Onyx Mesh core encounters an error processing an SDK request, it will respond with:

  1. an HTTP status code
  2. an Onyx Mesh error code
  3. an Onyx Mesh error message
  4. a data object containing extra information (optional)

Some errors (as denoted in the table below) will instruct the SDK to auto-retry with an exponential backoff until a timeout. If it succeeds, it will not return the error, but if it reaches the timeout, it will return the error.

The SDKs manage idempotency of requests and retries. In most cases, it should not be necessary to implement your own retry logic in addition to what the SDKs provide.

If your application has an operation with multiple Onyx Mesh requests that fails partway through, it is safe to retry the step that failed and continue from there, but not necessarily safe to start over.

HTTP Status CodeOnyx Mesh Error CodeOnyx Mesh Error MessageAuto-retry
400SEQ008One or more fields are missingNo
400SEQ050Alias already existsNo
400SEQ051Provided fields are exclusive in respect to each otherNo
400SEQ052Invalid key IDNo
400SEQ200Quorum must be greater than 1 and less than or equal to the length of xpubsNo
400SEQ201Invalid xpub formatNo
400SEQ203Retrieved type does not match expected typeNo
400SEQ204Root XPubs cannot contain the same key more than onceNo
400SEQ600Malformed pagination parameter afterNo
400SEQ601Incorrect number of arguments to filterNo
400SEQ602Malformed query filterNo
400SEQ610Invalid intervalNo
400SEQ706*One or more actions had an error: see attached dataDepends on the error contained in the action
400SEQ707No actions specified for transaction builderNo
500SEQ708Unexpected item in transactionNo
400SEQ709Wrong number of signaturesNo
400SEQ710Transaction unbalancedNo
400SEQ711Transaction exceeds allowed runlimit. Use fewer actions.No
400SEQ735Transaction rejectedNo
500SEQ739Error retrieving transaction after submissionYes

Nested ErrorsLink to this section

When making a transaction, errors will be returned for individual actions to make it easier to identify what went wrong. The following errors are returned as sub-errors of SEQ706 in the optional data field:

HTTP Status CodeOnyx Mesh Error CodeOnyx Mesh Error MessageAuto-retry
400SEQ701Invalid action typeNo
400SEQ702Invalid ID on actionNo
400SEQ703Invalid action objectNo
400SEQ704Invalid amount in actionNo
400SEQ760Insufficient funds for transactionNo
400SEQ761Some outputs are reserved; try againYes
400SEQ762Specified asset ID does not match account ID or asset ID in outputNo

Here's an example of accessing action errors in the SDK:

try {
  new Transaction.Builder()
    .addAction(
      new Transaction.Builder.Action.Issue()
        .setAssetId("fake")
        .setAmount(1)
        .setDestinationAccountId("alice")
    ).transact(ledger);
} catch (APIException e) {
  APIException actionError = e.data.actions.get(0);

  System.out.println(actionError.getMessage());
  // Code: SEQ702 Message: Invalid id on action

  System.out.println(actionError.seqCode);
  // SEQ702

  System.out.println(actionError.data.index);
  // 0, index of action that failed
}
ledger.transactions.transact(builder => {
  builder.issue({
    assetId: 'fake',
    amount: 1,
    destinationAccountId: 'alice',
  })
}).then(
  () => { /* success */},
  err => {
    let actionError = err.data.actions[0]

    console.log(actionError.message)
    // Invalid id on action

    console.log(actionError.seqCode)
    // SEQ702

    console.log(actionError.data.index)
    // 0, index of action that failed
  }
)
begin
  ledger.transactions.transact do |builder|
    builder.issue(
      asset_id: 'fake',
      amount: 1,
      destination_account_id: 'alice',
    )
  end
rescue OnyxMesh::APIError => e
  action_error = JSON.parse(e.response.body)['data']['actions'][0]

  p action_error['message']
  # Invalid id on action

  p action_error['seq_code']
  # SEQ702

  p action_error['data']['index']
  # 0, index of action that failed
end