Acreum Docs
Errors

Errors

Every error is an RFC 7807 problem with a stable code and a request id. Branch on the code; retry by status.

Every error response from /v1/* follows RFC 7807 Problem+JSON, extended with two Acreum-specific fields: a stable code and a request_id.

Content-Type: application/problem+json

The shape

{
  "type": "https://docs.acreum.io/errors/DOCUMENT_ALREADY_POSTED",
  "title": "Document already posted",
  "status": 409,
  "detail": "The document has already been posted to the general ledger and is now immutable except via adjustment documents.",
  "code": "DOCUMENT_ALREADY_POSTED",
  "request_id": "018f0b3d-7c2e-7a3a-9f52-2a14d86e08ad",
  "instance": "/v1/documents/4f2c…/post"
}
FieldAlways presentMeaning
typeyesDocumentation URI for the error code.
titleyesShort human-readable title. Stable per code.
statusyesHTTP status code. Mirrors the response status.
detailyesHuman-readable description of this occurrence. Not stable; copy may change.
codeyesThe stable identifier. Branch on this, not on status or detail.
request_idyesUUID identifying this request. Provide it to support.
instanceyesThe request path that produced the error.
errorssome codesArray of per-field entries: on VALIDATION_FAILED one per invalid field, on INSUFFICIENT_SCOPE one per missing scope.
contextsome codesMachine-readable detail for the code, for example the missing activation conditions on CONTRACT_ACTIVATION_NOT_READY.

How to consume errors

  1. Branch on code. It is the stable contract. New codes will be added; existing codes will not change meaning.
  2. Fall back on status. Group 4xx (client mistake), 429 (back off) and 5xx (transient or server bug; retry with backoff or escalate).
  3. Surface detail to humans, never to business logic.
  4. Always log request_id. It is the single id that correlates the request across HTTP logs, traces, the audit log and error tracking.
async function call(url: string, init: RequestInit) {
  const res = await fetch(url, init);
  if (!res.ok) {
    const problem = await res.json();
    switch (problem.code) {
      case 'IDEMPOTENCY_CONFLICT':
        throw new IdempotencyConflict(problem);
      case 'INSUFFICIENT_SCOPE':
        throw new ScopeMissing(problem);
      case 'RATE_LIMITED':
        return retryWithBackoff(res.headers.get('Retry-After'));
      default:
        throw new ApiError(problem);
    }
  }
  return res.json();
}

Validation errors

VALIDATION_FAILED (HTTP 400) carries an errors[] array. Each entry names the field that failed and a stable per-field code:

{
  "type": "https://docs.acreum.io/errors/VALIDATION_FAILED",
  "title": "Validation failed",
  "status": 400,
  "detail": "One or more request fields failed validation. See `errors[]` for details.",
  "code": "VALIDATION_FAILED",
  "request_id": "…",
  "instance": "/v1/documents",
  "errors": [
    { "field": "items.0.item_total", "code": "INVALID_VALUE", "message": "must be > 0" },
    { "field": "party_id", "code": "REQUIRED", "message": "required" }
  ]
}

Field paths use dot notation for nested objects and array indexes (items.0.item_total). Read errors[].field and errors[].code; do not regex detail.

Accounting gates

Many 409 and 422 codes come from the ledger's integrity gates rather than from input validation. The ones you will meet first:

codeMeaning
DOCUMENT_ALREADY_POSTEDPosted documents are immutable. Void and recreate, or reissue.
DOCUMENT_VOID_REQUIRES_MEMOVoiding a posted document needs a non-empty memo.
PERIOD_CLOSED / PERIOD_LOCKEDThe document date falls in a closed period. Send period_override_reason with the accounting:periods_override scope, or pick an open date. A locked period cannot be overridden.
DIMENSION_REQUIREDThe organization requires a custom field on this document type and it was not supplied (or not explicitly set to none).
ACCOUNT_LEGAL_ENTITY_MISMATCHA line names an account that belongs to a different legal entity.
DOCUMENT_RECONCILED_CANNOT_VOIDThe document is cleared on a completed bank reconciliation. Undo the reconciliation first.
DOCUMENT_TYPE_NOT_CREATABLE_HEREThis type has its own origin endpoint; the detail names it.

The full list of 520-plus codes, with the condition that raises each, is in the Error code catalog.

Retry policy

StatusRetry?
4xx (except 429)No. Client mistake. Fix the request.
429Yes, with exponential backoff. See Rate limits.
500Maybe. Retry once with a small delay; if it persists, treat as a bug and contact support with request_id.
502 / 503Yes, with exponential backoff. Cap retries at about five and surface the failure past that.

For all retries of POST creates and state-changing actions, send the same Idempotency-Key so a successful retry does not produce a duplicate. See Idempotency.

Reporting bugs

Include in any support contact:

  1. The code.
  2. The request_id.
  3. The request URL and method (no body required; we have it).
  4. The approximate UTC timestamp.

Write to support@acreum.io. We can usually resolve a request to its full server-side trace from request_id alone.

On this page