Errors

HIOBuy uses two error shapes: protocol errors (non-2xx HTTP with an error object) and business outcomes (HTTP 200 with success: false on some order routes).

Protocol errors (HTTP 4xx / 5xx) {#protocol-errors}

{
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "product_id, url, mi_id, or tao_password is required.",
    "request_id": "req_abc123",
    "category": "VALIDATION_ERROR"
  }
}
FieldDescription
error.codeMachine-readable enum — use for branching logic
error.messageHuman-readable explanation (English)
error.request_idSame as x-request-id response header
error.categoryCoarse grouping: AUTH_ERROR, RATE_LIMIT_ERROR, VALIDATION_ERROR, CHANNEL_ERROR, INTERNAL_ERROR
error.upstreamOptional vendor error summary on CHANNEL_UPSTREAM_ERROR (sanitized)

Error code reference {#error-codes}

The canonical machine-readable catalog is data/errors.catalog.json. Summary:

CodeHTTPCategoryWhen
INVALID_API_KEY401AUTH_ERRORInvalid or missing Bearer token
CHANNEL_NOT_AUTHORIZED401AUTH_ERRORChannel not authorized for this app
INSUFFICIENT_SCOPE403AUTH_ERROROperation not permitted for this key/app
FULFILLMENT_MODE_NOT_SUPPORTED403AUTH_ERROR/v1/fulfillment/* on self-fulfillment app
VALIDATION_ERROR400VALIDATION_ERRORMissing/invalid body fields, unsupported currency
UNSUPPORTED_CHANNEL400VALIDATION_ERRORUnknown channel value
UNSUPPORTED_FIELD400VALIDATION_ERRORe.g. currency on product routes
NOT_FOUND404VALIDATION_ERROROrder or resource does not exist
RATE_LIMIT_EXCEEDED429RATE_LIMIT_ERRORPer-minute rate limit
QUOTA_EXCEEDED429RATE_LIMIT_ERRORDaily channel quota exhausted
PLATFORM_QUOTA_EXCEEDED429RATE_LIMIT_ERRORPlatform-wide capacity limit
CHANNEL_CAPABILITY_NOT_SUPPORTED400CHANNEL_ERROROperation not available on this channel
CHANNEL_UPSTREAM_ERROR502CHANNEL_ERRORMarketplace rejected the call
INTERNAL_ERROR500INTERNAL_ERRORUnexpected Gateway failure — retry with backoff
PARCEL_NOT_FOUND404VALIDATION_ERRORInvalid or not yet inbound parcel (fulfillment)
INVALID_SHIPPING_CHANNEL400VALIDATION_ERRORBad shipping_channel_code
INSUFFICIENT_BALANCE402VALIDATION_ERRORFulfillment wallet too low for pay

Business failures (HTTP 200) {#business-failures}

Procurement preview/create/pay may return HTTP 200 with success: false when the marketplace refuses the operation but the Gateway request was valid.

{
  "channel": "1688",
  "success": false,
  "code": "ORDER_CREATE_FAILED",
  "message": "One or more lines could not be purchased.",
  "failed_offers": [
    {
      "offer_id": "...",
      "spec_id": "...",
      "error_code": "STOCK_NOT_ENOUGH",
      "error_message": "Insufficient stock"
    }
  ],
  "request_id": "req_..."
}
  • Check success before treating the call as completed
  • Inspect unavailable_lines (preview) or failed_offers (create)
  • Partial success: 1688 may return success: true with non-empty failed_offers

Product upstream failures {#upstream-product-errors}

Invalid Taobao口令, missing product, or vendor timeouts on product routes typically return 502 with CHANNEL_UPSTREAM_ERROR — not an empty product shell.

  1. Log request_id on every error path.
  2. Retry 429 and 500 with exponential backoff; do not retry 400 / 401 without fixing input.
  3. On 502 CHANNEL_UPSTREAM_ERROR, surface vendor message to ops; optionally retry once for transient outages.
  4. Order create: use external_order_id / Taobao outer_purchase_id for idempotency — see Procurement orders.