Latch Errors
All errors return JSON with error and code fields. Validation errors include a fields object with per-field messages.
{
"error": "Human readable message",
"code": "service.error_name",
"fields": { "field_name": ["Validation error message"] }
}
Error Reference
| Code | HTTP | Cause | Fix |
|---|---|---|---|
validation_error | 400 | Invalid key format, TTL, or timeout value | Check allowed key characters (alphanumeric, dash, underscore, colon). TTL and timeout max is 900,000ms. |
unauthorized | 401 | Missing or invalid API key | Add a valid Authorization: Bearer sm_... header. See Authentication. |
insufficient_balance | 402 | Account out of API credits | Upgrade your plan. See Pricing. |
forbidden | 403 | Token does not match the current lock holder | Verify you are using the token returned from your acquire call. The lock may have already been released or auto-released. |
not_found | 404 | Lock does not exist for this key | The lock was never acquired, already released, or expired. Use GET /v1/latch/:key to check status. |
request_timeout | 408 | Lock not acquired within the specified timeout | Increase timeout, or check if the lock holder is releasing promptly. Safe to retry. |
rate_limit_exceeded | 429 | Account rate limit hit or 100+ waiters already queued | Back off and retry. Queue-depth 429s are separate from account-level rate limits. See Rate Limits. |