Sonar scanner suddenly stopped working with no config or code changes

About a month ago (May 20th) our analysis pipeline just suddenly stopped working. The day before it worked fine and there were no configuration or code changes made in between. There is a default branch set for the project.

  • ALM used: Azure DevOps
  • CI system used: Azure DevOps
  • Scanner command used:
    - task: SonarCloudPrepare@1
      displayName: 'Prepare analysis on SonarCloud'
      inputs:
        scannerMode: CLI
        configMode: manual
        SonarCloud: sonarcloud
        organization: fake
        cliProjectKey: ${{ parameters.sonarKey }}
        cliProjectName: ${{ parameters.sonarProject }}
        cliSources: ${{ parameters.sonarSources }}
        configFile: ./sonar-project.properties
        extraProperties: |
          # Additional properties that will be passed to the scanner, 
          # Put one key=value per line, example:
          # sonar.exclusions=**/*.bin
          sonar.javascript.lcov.reportPaths=${{ parameters.workingDirectory }}/coverage/lcov.info
          sonar.junit.reportPaths=${{ parameters.workingDirectory }}/junit.xml
          ${{ parameters.sonarParameters }}
    - task: NodeTool@0
      displayName: Install Node.js
      inputs:
        versionSpec: 14.x
    - bash: |
        node --version
        npm install
        npm run --silent ${{ parameters.coverageTestName }}
        ./node_modules/sonarqube-scanner/dist/bin/sonar-scanner ${{ parameters.sonarPullRequestParameters }}
        echo "Remove this line allow failed tests to fail builds"
      displayName: Run tests
    - task: SonarCloudAnalyze@1
      displayName: Run Code Analysis
    - task: SonarCloudPublish@1
      displayName: Publish Quality Gate Result
  • Javascript/HTML/CSS
  • Error observed:
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:50)
	... 34 more
Caused by: Could not find a default branch to fall back on.

I’ve confirmed versions were the same before and after:

Hi,

Could we get the full error stacktrace, please?

 
Ann

That’s the full output of the error. Do you mean you want me to run with the -X flag?

Hi,

Stacktraces generally start with an error that gives the exception type. That starts with an “at” line. There’s more before that.

 
Ann

You’re right. My mistake.


	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at com.sun.proxy.$Proxy0.execute(Unknown Source)
	at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
	at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
	at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Unable to load component interface org.sonar.scanner.scan.branch.BranchConfiguration
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
	at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:50)
	... 34 more
Caused by: Could not find a default branch to fall back on.

The “Caused by” seems to be the same issue we face here: https://community.sonarsource.com/t/bitbucket-pipelines-started-failing-could-not-find-a-default-branch-to-fall-back-on/65144

Same story - 2 different projects broke at the same time over the weekend (so no code changes we know of), same error.

@ganncamp we use Bitbucket as ALM though

I just noticed it’s cut off again. Must be some kind of trimming happening. Here’s the top:

java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
##[debug]Processed: ##vso[task.logissue type=error;]14:17:13.767 ERROR: Error during SonarScanner execution%0Ajava.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
14:17:13.767 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
##[error]at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:52)
	at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
	at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
	at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
	at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
	at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
	at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
	at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
	at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
	at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
	at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
	at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
	at org.picocontainer.DefaultPicoContainer.instantiateComponentAsIsStartable(DefaultPicoContainer.java:1034)
	at org.picocontainer.DefaultPicoContainer.addAdapterIfStartable(DefaultPicoContainer.java:1026)
	at org.picocontainer.DefaultPicoContainer.startAdapters(DefaultPicoContainer.java:1003)
	at org.picocontainer.DefaultPicoContainer.start(DefaultPicoContainer.java:767)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:122)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.scanner.bootstrap.GlobalContainer.doAfterStart(GlobalContainer.java:128)
1 Like

Hi,

Thanks for the rest of the stacktrace.

Nothing jumped out at me from it, so I searched on the final Caused by and found several threads that indicate this is most likely a problem with either the project key or organization id configuration.

I know you said this started happening suddenly, with no intervention. But can you double-check that character-for-character (capitalization too) what’s being passed for project key and organization matches what’s set up in SonarCloud?

 
Ann

I can confirm that both are exact matches. I can provide specifics in a DM if that’s helpful.

1 Like

Hi @alex.denton.utr ,

Could you check if the following comment is also relevant for you?

Hmmm… that’s an interesting one. I could see that being the case. It’s possible that the token was generated by someone not on the org anymore. I’ll give that a look.

Okay. I was able to circle back and try generating a new token but same result.

I’m noticing something I don’t recall seeing before. I see that my project is bound to bitbucket. I use bitbucket for source control and Azure DevOps for CI. Could this be interfering?

FWIW I get a different error if I run analysis on my main branch:
Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator

I figured it out. There was a service connection for the Sonarcloud and the person who created it was removed from the organization. Basically an obfuscated authentication issue.

2 Likes

Thanks for following up on this thread, @alex.denton.utr. I think I have the same issue. Is there a way to determine which user created the project?

To resolve your issue did you delete the project in SC and start over or is there a less drastic way to achieve the same end?

I’m curious, if this was an authentication issue why do you think generating a new token did not resolve the issue for you?

Hi @Sully,

Welcome to the community!

I believe he’s probably talking about the PAT, rather than the project.

 
HTH,
Ann

Thank you, G Ann.

I’m sorry, but I don’t understand what you are trying to tell me. What does PAT stand for?

I checked the docs to see if that term was defined. Didn’t see anything that seemed like it fit. Is there another place that defines common acronyms that I should become familiar with?

Hi,

Sorry. PAT is Personal Access Token created on the DevOps Platform side.

Since this is a year-old thread you resurrected, I was trying to answer briefly.

Instead, please create a brand new thread with all your details.

 
Thx,
Ann