Thread status label update fails permanently on Graph "change key" conflict — treated as non-retryable
Environment
Self-hosted deployment, Docker image ghcr.io/elie222/inbox-zero:latest (build 2026-09-26T04:02:21Z) Provider: Microsoft Outlook / Microsoft Graph webhook Queue backend: bullmq with dedicated worker
Description
When two webhook notifications for the same message arrive close together (Microsoft appears to occasionally send duplicate/near-simultaneous notifications for a single event), two near-parallel attempts to update the thread's status label (e.g. "To Reply" → "Awaiting Reply"/"Actioned") can race. The first update succeeds and changes the item's Graph "change key"; the second fails because it's holding a stale change key. This second failure is logged as Non-retryable error encountered and the process gives up — it does not re-fetch the item and retry the label update.
Effect: the thread's category label can be left in a stale/incorrect state after a reply, requiring either a later duplicate webhook to self-correct it, or manual correction by the user.
Log excerpt (redacted)
[outlook/webhook]: Non-retryable error encountered { ... } [outlook/webhook]: Email provider operation failed { ... } [outlook/webhook]: Removed conflicting thread status labels { ... } [outlook/webhook]: Failed to apply thread status label { "labelId": "", "labelName": "To Reply", "dedupeKey": "", "deduped": false, "error": "The send or update operation could not be performed because the change key passed in the request does not match the current change key for the item." } { "requestId": "", "url": "/api/outlook/webhook", "subscriptionId": "", "messageId": "", "email": "", "emailAccountId": "", "threadId": "" } [outlook/webhook]: Thread status label application completed with errors { ... }
Expected behavior
On a Graph change-key conflict specifically, the operation should re-fetch the current item and retry the label update once, rather than being classified as non-retryable.
Separate, possibly related issue observed in the same session
Also seeing repeated failures in a different code path, same webhook flow:
[outlook/webhook]: Email provider operation failed { "error": "Syntax error: character ':' is not valid at position 12 in 'participants:'.", "operation": "getThreadsWithParticipant" } [outlook/webhook]: Failed to collect same-sender reply examples { "error": "Syntax error: character ':' is not valid at position 12 in 'participants:'." }
This looks like a malformed Microsoft Graph search query being built for the "collect same-sender reply examples" feature (participants: prefix isn't valid Graph search/KQL syntax as constructed). Non-fatal to the main flow but fails every time it runs for Outlook accounts.
Source: elie222/inbox-zero