Skip to content

fix: handle duplicate thread creation on Discord gateway reconnect#137

Open
the3mi wants to merge 1 commit intoopenabdev:mainfrom
the3mi:fix-duplicate-thread-creation
Open

fix: handle duplicate thread creation on Discord gateway reconnect#137
the3mi wants to merge 1 commit intoopenabdev:mainfrom
the3mi:fix-duplicate-thread-creation

Conversation

@the3mi
Copy link
Copy Markdown

@the3mi the3mi commented Apr 8, 2026

When Discord gateway reconnects, the same message event can be delivered twice. The second attempt to create a thread fails with HTTP 500 because the thread already exists.

This change catches the HTTP 500 error and queries the channel to find the existing thread, returning its ID instead of propagating the error.

Fixes: A thread has already been created for this message error on gateway reconnect.

When Discord gateway reconnects, the same message event can be
delivered twice. The second attempt to create a thread fails with
HTTP 500 because the thread already exists.

This change catches the HTTP 500 error and queries the channel to
find the existing thread, returning its ID instead of propagating
the error.
@the3mi the3mi requested a review from thepagent as a code owner April 8, 2026 05:28
@the3mi
Copy link
Copy Markdown
Author

the3mi commented Apr 8, 2026

👋 This fix is ready to merge and resolves the exact error currently affecting production: A thread has already been created for this message on Discord gateway reconnect.

The fix is minimal and safe — it only changes the error handler for thread creation to query existing threads instead of propagating the error. No behavior change for the happy path.

Could we get an expedited review? This is blocking production use.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant