Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

API returning conflict markers in PR diff without actual conflicts

Junior Sartori
December 22, 2025

Hello Bitbucket community,

I'm experiencing an issue where the Bitbucket Cloud API returns conflict markers in Pull Request diffs that have no actual conflicts.

Endpoint used:

GET /2.0/repositories/{workspace}/{repo_slug}/commits/{spec}/diff

Parameters:

  • spec: {commit_hash_1}..{commit_hash_2} (two-dot format)
  • path: specific file path

What's happening:

The API returns content with Git conflict markers like:

<<<<<<< destination:a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0
const API_TIMEOUT = 5000;
const MAX_RETRIES = 3;
=======
const API_TIMEOUT = 3000;
const MAX_RETRIES = 5;
>>>>>>> source:9z8y7x6w5v4u3t2s1r0q9p8o7n6m5l4k3j2i1h0

Important context:

  • The PR has no actual conflicts (Bitbucket UI confirms this)
  • The file was committed without conflicts
  • The commit hashes in the markers are valid and belong to the PR

Questions:

  1. Is this a known API bug?
  2. Is there a specific condition that causes this?
  3. Is there a workaround or alternative parameter we should use?

Thank you for your attention!

 

1 answer

0 votes
Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 25, 2025

Hi @Junior Sartori 

Can you please provide the full cURL command you're executing (with authentication/repo slug location hashed out)?

Cheers!

- Ben (Bitbucket Cloud Support)

Junior Sartori
January 6, 2026

Hey Ben!

Sorry for the delay in responding, I was away from work.

Is there any other way you can help me with this? It's just that the credentials are from a client who uses our code review platform

Could you send it by email so it doesn't stay registered here in the community post?

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 6, 2026

Hi @Junior Sartori 

We are unfortunately able to offer support via email. Are you able to completely remove the auth credentials and just replace with a placeholder like "username:AppPassword"? These aren't needed, I'm more so interested in the actual content of the command that's being executed.

Cheers!

- Ben (Bitbucket Cloud Support)

Junior Sartori
January 9, 2026

Got it, Ben. Thanks for the help. I'll send you the code snippets where we're building the file diffs.

First we fetch the PR data and the PR files, as you can see in this snippet below:

const pr = await bitbucketAPI.pullrequests
.get({
pull_request_id: prNumber,
repo_slug: `{${repo.id}}`,
workspace: `{${repo.workspaceId}}`,
})
.then((res) => res.data);

const prFiles = await bitbucketAPI.pullrequests
.getDiffStat({
pull_request_id: prNumber,
repo_slug: `{${repo.id}}`,
workspace: `{${repo.workspaceId}}`,
})
.then((res) =>
this.getPaginatedResults<Schema.Diffstat>(
bitbucketAPI,
res,
),
);

Then, with this data we fetch the diff between commits through this snippet here:
await bitbucketAPI.commits
.getDiff({
repo_slug: `{${repo.id}}`,
workspace: `{${repo.workspaceId}}`,
spec: `${pr.source?.commit?.hash}..${pr.destination?.commit?.hash}`,
path: pathForDiff,
})

Below I'm sending the complete snippet that contains this part that builds the diff, so you have a view of the whole thing.

const prFilesWithDiffAndContents = await Promise.all(
prFiles
.filter((file) => file.new?.path || file.old?.path)
.map(async (file) => {
const isRemoved = file.status === 'removed';
const pathForContent = isRemoved
? file.old?.path
: (file.new?.path ?? file.old?.path);
const commitForContent = isRemoved
? pr.destination?.commit?.hash
: pr.source?.commit?.hash;

const contents =
pathForContent && commitForContent
? await bitbucketAPI.source
.read({
repo_slug: `{${repo.id}}`,
workspace: `{${repo.workspaceId}}`,
commit: commitForContent,
path: pathForContent,
})
.then((res) => res.data as string)
.catch(() => null)
: null;

const pathForDiff = isRemoved
? file.old?.path
: (file.new?.path ?? file.old?.path);

const diff = pathForDiff
? await bitbucketAPI.commits
.getDiff({
repo_slug: `{${repo.id}}`,
workspace: `{${repo.workspaceId}}`,
spec: `${pr.source?.commit?.hash}..${pr.destination?.commit?.hash}`,
path: pathForDiff,
})
.then((res) =>
this.convertDiff(res.data as string),
)
.catch(() => null)
: null;

return {
...file,
contents,
diff,
};
}),

Our project is open source, so you can view the complete code we're using in the link below. The method where we fetch the code diff is getFilesByPullRequestId

[REDACTED]

I know you asked for the URLs, but our calls are made in this format. I tried to get the URLs by going into the Bitbucket modules, but everything is encrypted. Can you help me by analyzing it in this format?

Ben
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
January 11, 2026

Hi @Junior Sartori 

This appears to be Javascript code. Unfortunately, we can't assist with any code-related queries such as this, as it falls outside of our support scope (even for paid customers) - this includes analysis/interpretation of that code.

I'd suggest adding a method to print the exact API calls that are performed, as we'll need these to try to reproduce the issue on our side.

Thank you for your understanding.

Regards,

- Ben (Bitbucket Cloud Support)

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events