Error Codes

All CRM Service errors follow the standard EventZR envelope format with a machine-readable error code.

Error Envelope

Every error response includes: error.code (machine-readable), error.message (human-readable), error.http (status code), and meta.request_id (for tracing).

Error Response Format

{
  "data": null,
  "error": {
    "code": "ERR_CRM_NOT_FOUND",
    "message": "Contact with id 'abc-123' not found",
    "http": 404
  },
  "meta": {
    "request_id": "550e8400-e29b-41d4-a716-446655440000"
  }
}

Error Code Reference (14 codes)

CodeHTTPDescription
ERR_CRM_NOT_FOUND404Resource not found (contact, deal, account, etc.)
ERR_CRM_VALIDATION_FAILED400Request body validation failed
ERR_CRM_UNAUTHORIZED401Missing or invalid JWT token
ERR_CRM_FORBIDDEN403Insufficient role permissions
ERR_CRM_CONFLICT409Duplicate resource or merge conflict
ERR_CRM_BOOTSTRAP_FAILED503Lambda cold start failed — retry request
ERR_CRM_BAD_REQUEST400Malformed request (missing fields, wrong types)
ERR_CRM_INTERNAL_SERVER_ERROR500Unexpected server error
ERR_CRM_DEAL_ALREADY_CLOSED409Deal is already won/lost, cannot modify
ERR_CRM_PIPELINE_HAS_DEALS409Pipeline has active deals, cannot delete
ERR_CRM_CONTACT_MERGE_SELF400Cannot merge a contact with itself
ERR_CRM_IMPORT_IN_PROGRESS409An import is already running for this tenant
ERR_CRM_CONNECTOR_SYNC_FAILED502External CRM sync failed (Salesforce, HubSpot, Zoho)
ERR_CRM_RATE_LIMITED429Too many requests — retry after backoff