Skip to content

publisher: access token used as user_id in carousel child create for accounts with NULL user_id (THApiException #100) #281

Description

@ajianaz

Evidence (2026-09-23, prod v0.9.4)

Carousel publish on an account with user_id = NULL (manual-form account) failed at child container #1:

Threads API error: Unsupported post request. Object with ID
'THAASBUF8ygJdBYmJZAb0RfMFFQemdLQjNueG44RS1EWVJFMm9mbzBmVlVaalJETV94TkNkeFhaRFRJblNiQkh4cG4wUmI3MnM2REQ3TzMtUkxuU0UxZAGc1NEdvNmpnSnIzLTRVcTFVRUgwUzhFRWduM1RMUnRKaWVPbkNmenhVM1BpdlctVW9hUEFDR01yWnNjVVVreTJrQzJCRFZAlSjVZAMjcwU3ZAsQQZDZD'
does not exist ... [THApiException #100] (HTTP 400)

That "object ID" is not a Threads container ID — it is an encoded access token (length, alphabet, and prefix pattern match a Graph API token; the account's real user_id was NULL at the time). The publish path (or the #264 self-heal) passed the access token where a numeric user ID belongs, so Meta rejected the request.

Additionally, the #264 self-heal did not persist a corrected user_id: GET /api/accounts still showed user_id: null for this account after publish attempts and after a scheduler restart.

Impact

  • Any manual-form account (the very accounts that need the self-heal) cannot publish CAROUSEL/IMAGE/TEXT posts that address the user graph object.
  • The failure message gives no hint that identity resolution produced garbage.

Proposed fixes

  1. Before publish, require a numeric user_id; if missing, resolve via GET /me?fields=id,username and fail loudly (do not fall back to any non-numeric value) if resolution fails.
  2. Guard by format: user_id must match ^\d{15,20}$ before being used in any Graph path; log and reject otherwise (this turns the confusing fix: register migration 008 in store.migrate() #100 into a clear internal error).
  3. Persist the healed user_id back to the account row (currently it appears to stay NULL).
  4. Same format guard on the OAuth exchange path: the response's user_id should be validated before storage.

Repro: account added via manual form (user_id null) → schedule any CAROUSEL → approve → observe #100 with a token-shaped ID in the error.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions