java.lang.IllegalStateException: Character set is not defined for uploadItem

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

Problem

Whenever you try opening a review the following error can be found in the atlassian-fisheye.log:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2019-08-02 13:42:03,071 ERROR [qtp943573036-841 ] fisheye FRXDO-mapInlineComments - Error mapping comments. Cannot display comments on review CR-1. Error: Character set is not defined for uploadItem file.txt java.lang.IllegalStateException: Character set is not defined for uploadItem file.txt at com.cenqua.crucible.revision.managers.DefaultEncodedContentProvider.getCharset(DefaultEncodedContentProvider.java:103) [fisheye.jar:?] at com.cenqua.crucible.revision.managers.DefaultEncodedContentProvider.getContent(DefaultEncodedContentProvider.java:86) [fisheye.jar:?] at com.cenqua.crucible.revision.managers.DefaultContentManager.getContents(DefaultContentManager.java:641) [fisheye.jar:?] at com.cenqua.fisheye.diff.DiffHelper.getHunkList(DiffHelper.java:135) [fisheye.jar:?] at com.cenqua.crucible.revision.source.Source.getHunkList(Source.java:224) [fisheye.jar:?] at com.cenqua.crucible.view.FRXDO.getHunkList(FRXDO.java:1298) [fisheye.jar:?] at com.cenqua.crucible.view.FRXDO.getTetrisGrid(FRXDO.java:811) [fisheye.jar:?] at com.cenqua.crucible.view.FRXDO.mapInlineComments(FRXDO.java:829) [fisheye.jar:?] at com.cenqua.crucible.view.FRXDO.<init>(FRXDO.java:213) [fisheye.jar:?] at com.cenqua.crucible.revision.managers.DefaultContentManager.makeFRXDO(DefaultContentManager.java:130) [fisheye.jar:?] at com.atlassian.crucible.actions.ReviewBaseAction.makeFRXDO(ReviewBaseAction.java:546) [fisheye.jar:?] at com.atlassian.crucible.actions.ViewFRXAction$1.doInTransaction(ViewFRXAction.java:193) [fisheye.jar:?] at com.atlassian.crucible.actions.ViewFRXAction$1.doInTransaction(ViewFRXAction.java:166) [fisheye.jar:?] at com.atlassian.fisheye.spi.impl.DefaultTxTemplate.execute(DefaultTxTemplate.java:78) [fisheye.jar:?] at com.atlassian.crucible.actions.ViewFRXAction.execute(ViewFRXAction.java:166) [fisheye.jar:?] ...

Cause

This problem may happen when the review has files uploaded as Attachments or as Pre-commit patches.

At the moment these files get uploaded they don't have a charset / encoding defined (or Crucible fails to detect it), and this information goes missing into the database.

The error happens when Crucible tries to retrieve the information from the database and the charset cannot be found.

Resolution

  1. Shut down Crucible

  2. Backup the database using the database vendor software, just to be on the safe side.

  3. Query the database for the file mentioned in the stack trace (e.g., file.txt in the example above) by running this query:

    1 SELECT cru_charset, cru_upload_id, cru_original_name FROM cru_upload_item WHERE cru_original_name = 'file.txt';
  4. You may get a multiple rows in the query output, and among them you may see a few rows with cru_charset empty (or null):

    1 2 3 4 5 6 7 8 cru_charset | cru_upload_id | cru_original_name -------------+---------------+------------------- UTF-8 | 35205 | file.txt UTF-8 | 35206 | file.txt UTF-8 | 35264 | file.txt UTF-8 | 35265 | file.txt | 35377 | file.txt | 35376 | file.txt
  5. Fix the problem by adding 'UTF-8' to cru_charset where they're missing by running this query:

    1 2 UPDATE cru_upload_item SET cru_charset = 'UTF-8' WHERE cru_upload_id = 35376 AND cru_original_name = 'file.txt'; UPDATE cru_upload_item SET cru_charset = 'UTF-8' WHERE cru_upload_id = 35377 AND cru_original_name = 'file.txt';
  6. Start Crucible

Updated on April 8, 2025

Still need help?

The Atlassian Community is here for you.