Skip to content

messagix/instagram: treat missing Instagram thread as already deleted#263

Open
iFixRobots wants to merge 1 commit intomainfrom
fix/handle-deleted-instagram-thread
Open

messagix/instagram: treat missing Instagram thread as already deleted#263
iFixRobots wants to merge 1 commit intomainfrom
fix/handle-deleted-instagram-thread

Conversation

@iFixRobots
Copy link
Copy Markdown

Problem

When deleting an Instagram chat from Beeper that was already removed on the native Instagram app, the bridge enters an infinite retry loop.

The DeleteThread flow calls fetchRouteDefinitionPOST /ajax/route-definition/ to resolve the thread_fbid. When the thread no longer exists on Instagram, the endpoint returns 200 OK but with an empty thread_fbid, causing:

error="failed to fetch route definition for thread 116456373082512: thread_fbid not found in route definition response for thread 116456373082512"
status=FAIL_RETRIABLE

The FAIL_RETRIABLE status causes the client to retry indefinitely — a deletion that can never succeed.

Fix

  • Add ErrIGThreadNotFound sentinel error variable to fetchRouteDefinition (using %w wrapping)
  • In DeleteThread, check for this error with errors.Is and return nil — the chat is already gone, so the deletion intent is fulfilled
  • Log a warning for observability

Per Tulir's guidance in the ticket comments.

Impact

  • One file changed, 10 insertions, 1 deletion
  • No new dependencies
  • Only affects the Instagram DeleteThread path — all other callers of fetchRouteDefinition are unaffected

Fixes https://linear.app/beeper/issue/PLAT-36131

When deleting an Instagram chat that was already removed on the native
app, the route definition endpoint returns 200 but with an empty
thread_fbid. Previously this caused a FAIL_RETRIABLE error loop since
the bridge kept retrying a deletion that could never succeed.

Add ErrIGThreadNotFound sentinel error to fetchRouteDefinition so
DeleteThread can detect this case with errors.Is and return nil,
allowing the client to clean up the room locally.

Fixes PLAT-36131
@iFixRobots iFixRobots requested a review from tulir April 21, 2026 20:26
@tulir tulir changed the title [PLAT-36131] - fix: treat missing Instagram thread as already deleted messagix/instagram: treat missing Instagram thread as already deleted Apr 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants