Teams error 504 Gateway Timeout: 504 - gateway timeout
Last verified against Microsoft Learn - Status codes from bot conversational APIs
Gateway Timeout.What error 504 Gateway Timeout means
A service in the delivery chain waited on another and gave up. The Teams status table lists 504 as "Gateway Timeout," retry Yes with exponential backoff, and the rate-limit guide includes 504 among the codes that "must also be retried." For your outbound sends this is a transient platform-side timeout: the request may or may not have been applied, so idempotency matters - a retried send after an ambiguous 504 is how duplicate messages happen.
Keep the mirror image in mind too: when your endpoint is the slow party on inbound delivery, the channel-side symptom is the 502 bot-returned-an-error surface and, for invoke-style interactions, the "Unable to reach the app" client message. A 504 in your own reverse-proxy logs in front of the bot means your app server, not Microsoft, is timing out.
Ambiguity is the defining property here: unlike a clean 429 or 503, a 504 means the operation's outcome is unknown. Design for at-least-once delivery with deduplication rather than exactly-once assumptions, and log both the attempt and the retry decision so duplicates can be traced when they do slip through.
What it looks like
HTTP/1.1 504 Gateway Timeout
{
"error": {
"code": "GatewayTimeout",
"message": "Gateway Timeout."
}
}Why it happens
- Transient timeout between Microsoft services while processing your call.
- Platform incident increasing internal latencies.
- Your own reverse proxy timing out your app server (inbound mirror case - fix your handler latency).
How to fix Teams error 504 Gateway Timeout
- 1Retry with exponential backoff and jitter as documented.
- 2Make sends idempotent where duplicates hurt: track your own message keys and skip re-sends already acknowledged.
- 3If 504s appear in your proxy logs for inbound activities, profile the handler and move slow work off the request path.
How to stop it recurring
Same machinery as 503: durable queue, centralized retry with backoff and jitter, alerting on rates. Add duplicate suppression for user-visible messages so an ambiguous timeout never posts twice. Keep handler latency low enough that the inbound mirror case cannot occur - acknowledge first, work later.
Official reference: Microsoft Learn - Status codes from bot conversational APIs. See all Teams error codes or the Teams limits and quotas.
Related codes
- 503 Service Unavailable: 503 - service temporarily unavailableService is unavailable.
- 502 Bad Gateway: 502 - bot returned an error / service dependency failureFailed to send activity: bot returned an error
- 429 Throttled: Throttled - too many requestsToo many requests.
- Unable to reach the app: "Unable to reach the app" - invoke response timed outUnable to reach the app
Error 504 Gateway Timeout - quick answers
What does Teams error 504 Gateway Timeout mean?
A service in the delivery chain waited on another and gave up. The Teams status table lists 504 as "Gateway Timeout," retry Yes with exponential backoff, and the rate-limit guide includes 504 among the codes that "must also be retried." For your outbound sends this is a transient platform-side timeout: the request may or may not have been applied, so idempotency matters - a retried send after an ambiguous 504 is how
How do I fix Teams error 504 Gateway Timeout?
1. Retry with exponential backoff and jitter as documented. 2. Make sends idempotent where duplicates hurt: track your own message keys and skip re-sends already acknowledged. 3. If 504s appear in your proxy logs for inbound activities, profile the handler and move slow work off the request path.
Can I retry after error 504 Gateway Timeout?
Yes - this is a retryable condition. Back off (start around one second and double on each attempt, with jitter) and watch for a retry-after hint from the platform before resending.
Stop debugging Teams by hand
Connect the channel through Conferbot: tokens, webhooks and retries are handled, failures show as readable status.