This could be related to a misconfiguration of the project key or organization. Could you check if the project key you provided matches the project key on SonarCloud?
If the key is correctly configured could you share the log output of the GitHub action?
I get the following error in the analyze fase (https://github.com/sirups/Sirups.Essentials.Mvc/runs/810083444?check_suite_focus=true#step:10:59):
INFO: Total time: 31.652s
ERROR: Error during SonarScanner execution
INFO: Final Memory: 25M/125M
ERROR: Could not find a default branch to fall back on.
INFO: ------------------------------------------------------------------------
ERROR:
The SonarQube Scanner did not complete successfully
06:07:21.573 Post-processing failed. Exit code: 1
##[error]Process completed with exit code 1.
Can you double check that your main branch is the default one on SonarCloud ? If you go to Administration -> Branches and pull request, there should be a label “MAIN BRANCH” beside the name of your default branch.
Thanks a bundle!
I have just verified that my “MAIN BRANCH” is “main”. (Which is as expected)
The action failed on the “main” branch.
EDIT: I think what I wrote was a bit unclear. So just to be on the safe side.
The “Thanks a bundle” was for welcoming me to the community.
As far as I can tell the project is correctly setup in SonarCloud. But I am still getting the error.
I tried running my Github Action before it was created. (My expectation was that it would be created automatically)
Since that didn’t happen I created it by choosing the repository
I tried deleting the project in SonarCloud and tried running the action again. I still get “Could not find a default branch to fall back on.”
I can’t see anything special about my repository. I have a branch protection rule preventing pushes to the release branch, but that shouldn’t be relevant here since my Main branch is “main” and the current branch I’m running on is “main”.
If I create it manually without “onboarding” I’m able to get it to work.
However this sets it up with a “master” default branch and my “main” branch as a “secondary” branch.
Is this some issue with SonarQube requiring a “master” branch or something like that?
I tried creating it all over again with the “onboarding” feature (which sets up my branches as they should be) and I get the “Could not find a default branch to fall back on.”.
my “wrong” projectKey was: sonar.projectKey=jekyll-kw-loremipsum I switched to sonar.projectKey=n13org_jekyll-kw-loremipsum (so i prefixed my project key with the org) and the scan was successfully done.
I faced a issue is that Could not find a default branch for project with key "android-bvs", I already created the project with the correct project key.
I, and some other in my team on another repo, are suddenly facing this error message. We didn’t change anything on our side regarding the sonar properties, and we’ve made sure the project keys, organisation, etc are correct. We also updated our sonar tokens in Bitbucket but that hasn’t helped either. Any clues what could be going wrong? The only thing is that we aren’t admins on the sonar project - could that affect if the tokens we generate aren’t a high enough permission level?
The full output of the sonarcloud check looks like this:
14:11:29.944 INFO: EXECUTION FAILURE
14:11:29.944 INFO: ------------------------------------------------------------------------
14:11:29.944 INFO: Total time: 5.136s
14:11:29.983 INFO: Final Memory: 9M/27M
14:11:29.983 INFO: ------------------------------------------------------------------------
14:11:29.983 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: Could not find a default branch for project with key 'XXXXXX'. Make sure project exists.
14:11:29.984 ERROR:
14:11:29.984 ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.
✖ SonarCloud analysis failed. (exit code = 1)