Permission Problem in Gitlab Analyzis

  • CI system used: Gitlab CI
  • Scanner command used when applicable: sonar-scanner -X -Dsonar.qualitygate.wait=true
  • Languages of the repository: Ruby
  • Error observed:
14:15:41.488 INFO: ------------------------------------------------------------------------
14:15:41.489 INFO: EXECUTION FAILURE
14:15:41.489 INFO: ------------------------------------------------------------------------
14:15:41.489 INFO: Total time: 11.110s
14:15:41.516 INFO: Final Memory: 9M/37M
14:15:41.516 INFO: ------------------------------------------------------------------------
14:15:41.516 ERROR: Error during SonarScanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.filesystem.InputComponentStore
	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:127)
	at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:123)
	at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:109)
	at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:57)
	at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:51)
	at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
	at jdk.proxy1/jdk.proxy1.$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:126)
	at org.sonarsource.scanner.cli.Main.execute(Main.java:81)
	at org.sonarsource.scanner.cli.Main.main(Main.java:62)
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: Project not found. Please check the 'sonar.projectKey' and 'sonar.organization' properties, the 'SONAR_TOKEN' environment variable, or contact the project administrator

Hi there!

I’ve noticed our analysis jobs started to fail all of a new year’s sudden. We’ve faced similar error due to invalid token in the past --as they are associated with a user and not the organization itself. But it has been solved assuring tokens used are valid. The very same setup that have been working in all projects (last analysis was successful three days ago) stopped working today (in all projects, regardless of the language).

Cheers
Danilo

Hey there.

What’s happening right before this? Can you share the wider range of logs?

Sure:

14:58:58.575 DEBUG: Plugins loaded:
14:58:58.575 DEBUG:   * License for SonarLint 8.0.0.51767 (license)
14:58:58.576 DEBUG:   * Python Code Quality and Security 4.14.0.14263 (python)
14:58:58.576 DEBUG:   * Java Code Quality and Security 7.29.0.34131 (java)
14:58:58.576 DEBUG:   * XML Code Quality and Security 2.10.0.4108 (xml)
14:58:58.576 DEBUG:   * JaCoCo 1.3.0.1538 (jacoco)
14:58:58.577 DEBUG:   * IaC Code Quality and Security 1.23.0.7263 (iac)
14:58:58.580 DEBUG:   * Text Code Quality and Security 2.7.1.1388 (text)
14:58:58.580 DEBUG:   * JavaScript/TypeScript/CSS Code Quality and Security 10.10.0.24774 (javascript)
14:58:58.877 DEBUG: GET 200 https://sonarcloud.io/api/server/version | time=296ms
14:58:58.880 DEBUG: Updated analysis started with a difference of -82 milliseconds
14:58:58.896 DEBUG: Started at Wed Jan 03 14:58:56 GMT 2024
14:58:59.254 INFO: Found an active CI vendor: 'Gitlab CI'
14:58:59.270 INFO: Load project settings for component key: 'origem1_[MASKED]2'
14:58:59.579 DEBUG: GET 200 https://sonarcloud.io/api/settings/values.protobuf?component=origem1_[MASKED]2 | time=309ms
14:58:59.582 INFO: Load project settings for component key: 'origem1_[MASKED]2' (done) | time=312ms
14:58:59.588 INFO: Process project properties
14:58:59.595 DEBUG: Process project properties (done) | time=7ms
14:58:59.600 INFO: Project key: origem1_[MASKED]2
14:58:59.600 INFO: Base dir: /builds/origem1/origem-dev/[MASKED]2
14:58:59.600 INFO: Working dir: /builds/origem1/origem-dev/[MASKED]2/.scannerwork
14:58:59.601 DEBUG: Project global encoding: UTF-8, default locale: en_US
14:58:59.602 DEBUG: Creating module hierarchy
14:58:59.602 DEBUG:   Init module 'Mothership2'
14:58:59.603 DEBUG:     Base dir: /builds/origem1/origem-dev/[MASKED]2
14:58:59.603 DEBUG:     Working dir: /builds/origem1/origem-dev/[MASKED]2/.scannerwork
14:58:59.603 DEBUG:     Module global encoding: UTF-8, default locale: en_US
14:58:59.691 INFO: Load project branches
14:59:00.019 DEBUG: GET 200 https://sonarcloud.io/api/project_branches/list?project=origem1_[MASKED]2 | time=328ms
14:59:00.024 INFO: Load project branches (done) | time=333ms
14:59:00.027 INFO: Check ALM binding of project 'origem1_[MASKED]2'
14:59:00.326 DEBUG: GET 200 https://sonarcloud.io/api/alm_integration/is_project_bound?project=origem1_[MASKED]2 | time=298ms
14:59:00.329 INFO: Detected project binding: BOUND
14:59:00.329 INFO: Check ALM binding of project 'origem1_[MASKED]2' (done) | time=302ms
14:59:00.332 INFO: Load project pull requests
14:59:00.680 DEBUG: GET 200 https://sonarcloud.io/api/project_pull_requests/list?project=origem1_[MASKED]2 | time=347ms
14:59:00.686 INFO: Load project pull requests (done) | time=354ms
14:59:00.690 INFO: Load branch configuration
14:59:00.694 INFO: Auto-configuring pull request 575
14:59:01.204 DEBUG: GET 401 https://sonarcloud.io/api/alm_integration/show_pullrequest?project=origem1_[MASKED]2&pullrequestKey=575 | time=507ms
14:59:01.210 INFO: ------------------------------------------------------------------------
14:59:01.210 INFO: EXECUTION FAILURE
14:59:01.210 INFO: ------------------------------------------------------------------------
14:59:01.211 INFO: Total time: 7.675s
14:59:01.240 INFO: Final Memory: 9M/37M
14:59:01.240 INFO: ------------------------------------------------------------------------
14:59:01.240 ERROR: Error during SonarScanner execution

Thanks.

Which token did you verify, and where? Typically this issue comes from an expired token in the global organization Administration > Organization settings managing the overall connection with Gitlab.

Thank you, Colin. I was looking into the SonarCloud tokens, but the problem indeed was caused by an expired personal GitLab token. Problem solved.

Danilo

1 Like