Good morning,
I know that there are a bunch of existing topics dealing with LOC limits. I looked then through but have not got the idea what’s going on.
Long story short, we are using SonarQube Cloud, we have 8 projects, on the main page each project has a description of smth like
*Last analysis: 3/13/2026, 4:05 PM 15k Lines of Code C#, XML*
If I sum all 8 values, I’ll get smth around 300k. Our paid limit is 500k.
Pipeline (Azure) step was off for some time, but when I turned it on, I’ve started getting the following error:
##[error][ERROR] SonarQube Cloud: Error while executing task Publish: Task failed with status FAILED, Error message: This analysis will make your organization ‘org-name’ reach the maximum allowed lines limit of 500000. Current LOC usage is: 348969. LOC count in this analysis: 360096. Language distribution: cs=17095,web=342986,xml=15
And it is really confusing. I’ve tried to reach support, but she told me to go and post here.
Thank you in advance.
David.
Hi @DavidSyrkin,
Thanks for reaching out and welcome to the Community!
The LOC shown for a project’s last analysis is not necessarily the LOC used for your organization’s subscription calculation.
For SonarQube Cloud, each project contributes the LOC count of its largest analyzed branch or pull request. This is retained as the project’s billed LOC, even if a subsequent analysis (e.g. the latest analysis on the main branch) contains fewer lines.
That explains the difference you’re seeing: the approximately 300k LOC obtained by summing the “Last analysis” values reflects only those latest analyses, while the 348,969 current usage reflects the largest branch/PR analyzed for each project.
The error you’re seeing tallies the current LOC of the project you are scanning. The incoming analysis is 360,096 LOC, so accepting it would raise the organization’s total beyond the 500k limit.
In this case you will need to ‘scope’ the project to exclude the ‘web’ files for example. With SonarScanner for .NET 8.0 and later, multi-language analysis is enabled by default, so the scanner can automatically include web-related files such as HTML, CSS, JavaScript, and TypeScript, even when they are not part of the C# build.
Since this is a C# project, a straightforward option is to disable that automatic multi-language discovery. You can do this with this parameter: /d:sonar.scanner.scanAll=false. See: Configuring the scanner | SonarQube Cloud | Sonar Documentation.
Does that help?
Best regards,
Stevan