Skip to content

[Bug]: Bitbucket PR comments fail because permission preflight returns HTTP 404 #9034

Description

@OliStarCooke

Before submitting

  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.

Area

apps/server

Steps to reproduce

  1. Configure Bitbucket using T3CODE_BITBUCKET_EMAIL and T3CODE_BITBUCKET_API_TOKEN.
  2. Use a token with read/write pull-request and repository scopes, plus read:user:bitbucket.
  3. Restart T3 Code.
  4. Open any Bitbucket Cloud pull request.
  5. Enter a comment and submit it.

Expected behavior

T3 Code should post the comment to the Bitbucket pull request.

Actual behavior

T3 Code shows Could not post the comment.

Before it posts the comment, the server calls:

GET /2.0/user/permissions/repositories?q=repository.full_name="<redacted>"

Bitbucket returns HTTP 404. T3 Code then fails in getViewerPermissions, so it never sends the comment request:

POST /2.0/repositories/<workspace>/<repository>/pullrequests/<number>/comments

The same token returns HTTP 200 for /2.0/user and the pull-request read endpoints. This does not appear to be an authentication or token-scope problem.

This is a follow-up to #6341 and #6525. That fix handles HTTP 410 from the removed endpoint. Some accounts receive HTTP 404 instead.

Bitbucket now documents GET /2.0/user/workspaces/{workspace}/permissions/repositories for reading the caller's effective repository permissions. Unlike the repository permission-management endpoints, this endpoint requires only read:repository:bitbucket for an API token:

https://developer.atlassian.com/cloud/bitbucket/rest/api-group-repositories/#api-user-workspaces-workspace-permissions-repositories-get

Impact

Blocks work completely

Version or commit

T3 Code Nightly 0.0.38-nightly.20260831.1236

Environment

Linux server, T3 Code web UI, Bitbucket Cloud

Logs or stack traces

PullRequestOperationError:
Pull request operation comment failed: Bitbucket returned HTTP 404

PullRequestProviderError:
bitbucket failed in getViewerPermissions:
Bitbucket returned HTTP 404

GET /2.0/user/permissions/repositories
HTTP 404

All credentials, repository names, pull-request numbers, account details, request IDs, and token identifiers have been redacted.

Workaround

Post the comment through Bitbucket's web UI.

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