Microsoft Teams Bot Framework · error code

Teams error 412 PreconditionFailed: PreconditionFailed - concurrent operations on one conversation

RetryableHTTP 412Conversations & activities

Last verified against Microsoft Learn - Status codes from bot conversational APIs

What Teams returns
Precondition failed, please try again.

What error 412 PreconditionFailed means

The status table documents PreconditionFailed as "A precondition failed on one of our dependencies due to multiple concurrent operations on the same conversation," with retry Yes and the strategy "Retry with exponential backoff." In other words: two or more of your requests raced on the same conversation state inside Microsoft's storage layer, one of them lost, and losing is recoverable.

Bots see this when they parallelize sends, updates, or deletes into the same thread - a fan-out worker pool that happens to schedule two operations on one conversation simultaneously, or a card update fired while the previous update is still in flight. The rate-limit guide reinforces the handling: "In addition to retrying error code 429, error codes 412, 502, and 504 must also be retried." A single serialized queue per conversation makes the error effectively disappear.

Unlike 429 there is no Retry-After header and no budget being enforced; this is optimistic concurrency losing a race, so the retry can be quick - the documented exponential backoff exists to stop two colliding writers from colliding again on the same schedule.

What it looks like

{
  "error": {
    "code": "PreconditionFailed",
    "message": "Precondition failed, please try again."
  }
}

Why it happens

  • Multiple worker threads or lambdas write to the same conversation concurrently.
  • A card update is issued before the previous update's response returned.
  • Retry logic re-fires an operation that is still executing, doubling it.

How to fix Teams error 412 PreconditionFailed

  1. 1Retry the failed request with exponential backoff plus jitter, as documented.
  2. 2Serialize operations per conversation: one in-flight write per conversationId (a keyed mutex or per-conversation queue).
  3. 3Coalesce rapid successive card updates into the latest state instead of sending every intermediate version.
  4. 4If 412s persist after serialization, capture X-Correlating-OperationId values and check whether an external process (another instance of your bot) is writing to the same conversations.

How to stop it recurring

Key your send pipeline by conversation ID so concurrency happens across conversations, never within one. This also keeps you inside the per-thread rate limits, whose windows are tight enough that intra-conversation parallelism buys nothing anyway. Wrap Connector calls in the SDK's transient-fault retry policy once, centrally, rather than per call site.

Official reference: Microsoft Learn - Status codes from bot conversational APIs. See all Teams error codes or the Teams limits and quotas.

Related codes

Error 412 PreconditionFailed - quick answers

What does Teams error 412 PreconditionFailed mean?

The status table documents PreconditionFailed as "A precondition failed on one of our dependencies due to multiple concurrent operations on the same conversation," with retry Yes and the strategy "Retry with exponential backoff." In other words: two or more of your requests raced on the same conversation state inside Microsoft's storage layer, one of them lost, and losing is recoverable.

How do I fix Teams error 412 PreconditionFailed?

1. Retry the failed request with exponential backoff plus jitter, as documented. 2. Serialize operations per conversation: one in-flight write per conversationId (a keyed mutex or per-conversation queue). 3. Coalesce rapid successive card updates into the latest state instead of sending every intermediate version. 4. If 412s persist after serialization, capture X-Correlating-OperationId values and check whether an external process (another instance of your bot) is writing…

Can I retry after error 412 PreconditionFailed?

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.