status mirrors the HTTP status; code is the stable identifier to branch on; message is human-readable detail. Each endpoint page lists exactly which codes it can raise.
The agent knowledge base API uses the same three fields and adds a
failure object to many errors. For what failure tells you and when to retry, see its Handle Errors section.Status Classes at a Glance
On Dify Cloud, a
401 response from an app API can also mean the request was blocked by IP access control. If your API key is valid, ask the app administrator to check whether the request’s source IP is allowed.Provider Errors Are Configuration Errors
Four common 400 codes point at the app’s model setup rather than your request:provider_not_initialize: no valid model credentialsprovider_quota_exceeded: the model provider’s own quota ran outmodel_currently_not_support: the model isn’t currently supportedcompletion_request_error: an error occurred while making a completion request
Rate Limits and Quotas
The two 429 codes mean different things:too_many_requestsis a concurrency ceiling—too many simultaneous requests for the app right now. Back off and retry.rate_limit_erroris a plan quota on Dify Cloud, such as workflow executions. Retrying won’t clear it; it resets with the quota period or a plan change.
403 responses, such as the request rate limit. These carry the forbidden code. Classic knowledge base endpoints use the same code for access restrictions, so read the message to tell them apart rather than switching on code alone.
Errors Inside Streams
Once an app stream opens, the HTTP status is already200: failures arrive as an error event and end the stream. The event’s code values are the same ones documented here—classify them with the same rules. See Consume Streaming Responses for details.
What to Retry
-
Retry with backoff:
too_many_requests,500, and network failures. - Don’t retry as-is: validation errors (fix the request first), authorization failures, or quota errors (they won’t clear until the quota does).
-
Fix, don’t retry: a
404from a resume call means the wronguseror a run that doesn’t exist. Correct the identifier instead.