"check and set the projectKey according to what is listed in the sample file. For me it was a combination of organization and actual project key, not the name of the project in SonarQube!"
This did the trick for me. I was getting the error
Could not find a default branch for project with key...
when using project key only for -Dsonar.projectKey.
After Changing this to -Dsonar.projectKey=${SONAR_ORGANIZATION}_${CI_PROJECT_NAME} error went away. Thank you!