Skip to content

[Bug]: Bitbucket Server / Data Center pull requests unsupported — remote on an IP host is treated as generic and has no PR URL shape #38548

Closed as not planned

Description

@huangy7

Before submitting

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

Area

packages/source-control-bitbucket, packages/shared

What happens

A project cloned from a self-hosted Bitbucket Server / Data Center instance cannot link or watch pull requests. Every call fails with:

This thread's project is on a host with no known pull request URL shape. Pass url.

The same happens with all three input shapes:

  • link_pull_request(url: "http://<host>:7990/projects/PROJ/repos/repo/pull-requests/178") → PullRequestUrlInvalidError
  • link_pull_request(host, repository, number) → PullRequestUrlUnavailableError
  • link_pull_request(repository, number) → PullRequestUrlUnavailableError

Reproduction

  1. git remote add origin http://10.x.x.x:7990/scm/PROJ/repo.git — the standard Bitbucket Server HTTP clone URL (/scm/ prefix, host is an IP or a hostname without a bitbucket label).
  2. Open the project in T3 Code and call link_pull_request with the web URL http://10.x.x.x:7990/projects/PROJ/repos/repo/pull-requests/1.
  3. Observe the error above. watch_pull_request fails the same way, so PR comments never wake the thread.

Root cause (0.1.10 bundle)

packages/source-control-bitbucket/src/shared/definition.ts:

recognizeRemote: ({ host, hostname }) =>
  hostname === "bitbucket.org" || hostname.split(".").includes("bitbucket")
    ? { kind, name: hostname === "bitbucket.org" ? "Bitbucket" : "Bitbucket Self-Hosted", baseUrl: `https://${host}` }
    : null
  • A Bitbucket Server host that is an IP (10.x.x.x) or a hostname without a bitbucket label is not recognized at all. The remote falls back to generic, which defines no changeRequestUrl / parseChangeRequestUrl, so changeRequestHost() returns null and the toolkit raises PullRequestUrlUnavailableError.
  • Even when the host does contain bitbucket, the shared definition still assumes Bitbucket Cloud:
    • CHANGE_REQUEST_PATH = /^\/([^/]+\/[^/]+)\/pull-requests\/(\d+)(?:\/|$)/ (/{workspace}/{repo}/pull-requests/{id}), while Server uses /projects/{projectKey}/repos/{repoSlug}/pull-requests/{id}
    • baseUrl is hard-coded to https://${host}, while Server instances are commonly plain HTTP on port 7990 and may be served under a context path (/bitbucket/...)

Bitbucket Server URLs for reference

  • clone: http://<host>:7990/scm/<PROJECT_KEY>/<repo_slug>.git
  • PR page: http://<host>:7990/projects/<PROJECT_KEY>/repos/<repo_slug>/pull-requests/<id>
  • REST: http://<host>:7990/rest/api/1.0/projects/<PROJECT_KEY>/repos/<repo_slug>/pull-requests/<id>

Expected

A Bitbucket Server / Data Center instance should be usable for PR linking, watching and actions, e.g.:

  • provider detection that does not depend on a bitbucket label in the hostname — an explicit "server base URL" setting is fine, since self-hosted instances cannot be inferred from the host;
  • parseChangeRequestUrl / changeRequestUrl for the /projects/.../repos/.../pull-requests/{id} shape with an optional context path and arbitrary scheme/port;
  • PR reads and actions through /rest/api/1.0/... with a personal access token (state, comments, approve, merge).

Environment

  • T3 Code 0.1.10 (macOS, beta)
  • Bitbucket Server 7.x, HTTP, port 7990

Activity

  1. juliusmarminge commented on Nov 18, 2026

    @juliusmarminge
    Member

    Thanks for writing this up. It asks for new behaviour rather than reporting a defect, so it does not belong in the bug tracker and I'm closing it as not planned here. Feature ideas are discussed in Discussions: please post it there.

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