Key length causes error in project analysis - maximum authorized 400

Hi,

  • which versions are you using : sonarqube 9.3 enterprise edition
  • what are you trying to achieve : scan project and view his analysis in server side

While analyzing one of our projects, we discovered that sonarqube was showing the following exception:
The last Project Analysis on this project (feature/******) failed. You can find more details below by clicking on the cog menu, and then “Show Error Details”.
Caused by: java.lang.IllegalArgumentException: Component key length (405) is longer than the maximum authorized (400)

There seems to be a 400 character limit on the length of the project key.
Our project is coded with the nodejs language and it is impossible for us to shorten the project key.

is it possible to increase this limit or remove it because it blocks the analysis of our project?
is it possible to fail the build of the project when the server side analysis fails?

best regards

Hi,

First, yes you should be able to fail your pipeline if back-end processing fail. The docs should help. Note that if Background processing fails, your Quality Gate status will come back as Error, so there are actually 3 states for this ‘boolean’.

Regarding the core of your question, I wouldn’t want to directly manipulate the database; more than likely it will result in some future upgrade migration failing.

Could you describe how you end up with >400 char project ids?

 
Ann

Hello Ann,
Thank for your reponse.
we’re going to set up the fail of the pipeline if the back end processing fails.

The development team tells us that by respecting the structure of dom (nodejs) and by giving a comprehensible name to their component, the limit of 400 characters is exceeded

So, I understand that it is not possible to increase this threshold of 400 char without taking risks on the next migration ?

best regards
Emilien

Hi Emilien,

That’s correct. The limit of 400 chars is not “artificial” - it’s actually limited by the size of the database columns storing those keys.
I suggest you find a way to encode a shorter key, like hashing part of it.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.