Error Classification
Sparrow classifies every delivery error into one of 9 categories. The classification determines whether the delivery is retried or permanently failed.
Error Categories
Section titled “Error Categories”| Category | Retryable | Description |
|---|---|---|
success | n/a | Delivery succeeded |
client_error | No | HTTP 4xx response (bad request, unauthorized, not found, etc.) |
server_error | Yes | HTTP 5xx response (internal server error, bad gateway, etc.) |
timeout | Yes | Request timed out before receiving a response |
connection_refused | Yes | Target endpoint refused the TCP connection |
network_error | Yes | Other network errors (ECONNRESET, EPIPE, EHOSTUNREACH) |
dns_error | No | DNS resolution failed (no such host) |
tls_error | No | TLS/SSL handshake failure (certificate errors) |
unknown | No | Unclassified error |
Retry Behavior
Section titled “Retry Behavior”When a delivery attempt fails with a retryable error category, Sparrow re-enqueues the delivery with exponential backoff:
backoff = retry_backoff_seconds * 2^(attempt - 1) + random_jitterRetries continue until:
- The delivery succeeds
max_retriesattempts are exhausted (terminalFAILEDstatus)- The event’s
ttl_secondsexpires (terminalEXPIREDstatus)
Non-retryable errors immediately mark the delivery as FAILED regardless of remaining retry budget.
Classification Logic
Section titled “Classification Logic”The error classifier inspects the Go error chain to determine the category:
-
HTTP response code — If a response was received:
- 2xx matching
expected_status_codes->success - 4xx ->
client_error - 5xx ->
server_error
- 2xx matching
-
Error type inspection — If no response:
*net.DNSError->dns_error- TLS-related errors ->
tls_error net.ErrorwithTimeout()->timeoutsyscall.ECONNREFUSED->connection_refusedsyscall.ECONNRESET,EPIPE,EHOSTUNREACH->network_error- String pattern fallback for edge cases
Monitoring Errors
Section titled “Monitoring Errors”Use the HealthService to monitor error patterns:
GetWebhookHealthreturns error category breakdown (client_errors, server_errors, timeout_errors, network_errors) for the last 24 hoursListWebhooksByHealthfinds all webhooks withUNHEALTHYorDEGRADEDstatusGetDeliveryAttemptsshows per-attempt error details for debugging