Forums

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

API Issue: Multiline Suggestion Anchor (NaN) Not Mapped Correctly on Bitbucket Server REST API

Hugo Fernando Silva Álvarez
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 2, 2025

Context:

  • I am programmatically posting a suggestion comment to a Bitbucket Server PR using the POST /rest/api/1.0/projects/{projectKey}/repos/{repositorySlug}/pull-requests/{pullRequestId}/comments endpoint.
  • Payload:
    {
        "text": "The progress bar component does not expose its name, role, state, and value programmatically to assistive technologies. The visual progress indicator lacks proper ARIA attributes such as role=\"progressbar\", aria-valuemin, aria-valuemax, aria-valuenow, and aria-label, making it impossible for screen readers and other assistive technologies to correctly interpret and announce the progress information to users.\n\n```suggestion\n <div\n className=\"w-full bg-gray-200 dark:bg-gray-700 rounded-full h-2 mt-2\"\n role=\"progressbar\"\n aria-valuemin={0}\n aria-valuemax={100}\n aria-valuenow={Math.round((userData?.completedLessons / userData?.totalLessons) * 100) || 0}\n aria-label={`Learning progress: ${userData?.completedLessons} out of ${userData?.totalLessons} lessons completed`}\n >\n <div\n className=\"bg-blue-600 h-2 rounded-full transition-all duration-300\"\n style={{\n width: `${\n (userData?.completedLessons / userData?.totalLessons) * 100\n }%`,\n }}\n />\n </div>\n```",
        "anchor": {
            "diffType": "EFFECTIVE",
            "line": 116,
            "lineType": "ADDED",
            "fileType": "TO",
            "path": "src/components/DynamicHomeContent.tsx",
            "srcPath": "src/components/DynamicHomeContent.tsx",
            "multilineMarker": {
                "startLine": 107,
                "startLineType": "ADDED"
            },
            "multilineSpan": {
                "srcSpanStart": 107,
                "srcSpanEnd": 116,
                "destSpanStart": 107,
                "destSpanEnd": 122  // I tried 121, 123, and 124, but it always fails.
            }
        }
    }

The Goal:

  • To enable the "Apply suggestion" button for a code block replacement that spans multiple lines (L107-L116) in the destination file.

The Problem (Behavior):

  • When the suggestion is posted, the interface displays the line numbers in the diff as NaN (Not a Number) instead of the actual line range (107-116).Captura de pantalla 2025-10-02 a la(s) 15.55.20.png

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events