The "Edit" button is disabled in the Source view of Bitbucket Datacenter UI
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Scenario A: The "Edit" button is disabled for a few pages in the Source view of the Bitbucket UI and therefore unable to directly edit the file in the Bitbucket UI.
Scenario B: The "Edit" button is disabled for a few pages in the Source view of the Bitbucket UI and shows "This file is too large to edit
".
Cause
Scenario A.
The page.max.source.length
property defines the maximum length for any line that can be returned from a given file when viewing in Source view. By default, the value is set to 5000 within the Bitbucket application. If a line is greater than 5000 characters, the characters exceeding 5000 will be truncated when accessing the file in the Source View. Therefore, the Edit button is disabled as the complete line is not loaded in that respective file.
Here's an example of a file from a sample repository:

To identify the line number exceeding 5000 characters, clone
or checkout
the repository to your machine and execute the below command to list the line number. Ensure to replace 'sample.txt'
with the respective filename of your instance.
1
2
3
4
cat sample.txt | awk 'length($0) > 5000 { print NR }'
Output:
2
Scenario B
The Bitbucket get file content REST API currently does not have a maximum limit imposed on the page size (limit parameter) for paged requests. This leads to performance degradation when consumers specify a large limit, resulting in longer response times and increased load on the system. To enhance user experience and maintain system stability, there is a maximum limit imposed on the page size to 5000.

Solution
For Scenario A:
Solution 1 (Recommended):
You can review the line and break it into 2 or more lines if possible in your machine and push a new commit to the Bitbucket. The "Edit" button will now be enabled as long as there is not any line that exceeds 5000 characters.
Solution 2:
You can increase the page.max.source.length
to a value greater than 5000 by adding the below property to the bitbucket.properties
file and restart the Bitbucket application for it to take effect. The "Edit" button will now be enabled as long as there is not any line that exceeds the value you've set. Please be advised that increasing the value of this property will consume more CPU/Memory resources and may potentially introduce performance issues.
1
page.max.source.length=6000
For Scenario B:
Follow the below steps:
Go to
<Bitbucket-Home>/shared
directory on the Bitbucket Server.Open the
bitbucket.properties
file and addpage.max.source.lines=10000
or a higher value than 10000:1
page.max.source.lines=10000
Once the parameter has been added, restart Bitbucket to let this property be effective within Bitbucket.
Verify the files after Bitbucket comes up.
Was this helpful?