401 and 404 Even though Token is setted

Hi everyone! :wave:

I’m trying to insert Sonarcloud in a CircleCI pipeline through its YML in our Github repository, the scan is correctly triggered but it is having trouble with the requests:

18:38:11.628 DEBUG: GET 404 https://sonarcloud.io/api/project_branches/list?project=[spoiler]PROJECTNAME[/spoiler] | time=272ms
18:38:11.628 DEBUG: Could not process project branches - continuing without it
18:38:11.628 INFO: Load project branches (done) | time=273ms
18:38:11.630 INFO: Check ALM binding of project PROJECTNAME
18:38:11.898 DEBUG: GET 401 https://sonarcloud.io/api/alm_integration/is_project_bound?project=[spoiler]PROJECTNAME[/spoiler] | time=267ms
18:38:11.898 WARN: Failed to check if project 'PROJECTNAME' is bound
18:38:11.898 INFO: Detected project binding: ERROR
18:38:11.898 INFO: Check ALM binding of project 'PROJECTNAME' (done) | time=268ms
18:38:11.900 INFO: Load project pull requests
18:38:12.173 DEBUG: GET 404 https://sonarcloud.io/api/project_pull_requests/list?project=PROJECTNAME | time=272ms
18:38:12.173 DEBUG: Could not process project pull requests - continuing without it

and at the end:

Caused by: Could not find a default branch to fall back on.

Apparently the scan is not correctly using the Sonar token that is defined in GitHub.

The project is correctly bound when I look at the platform. I’m in the same conditions as other repos that the scan works just fine. The only difference is that this repo works with Gradle, but I don’t believe that this would cause this type of issue.

I’ve check the solution to this similar issue here but it doesn’t work as well.

Does anyone have any ideas? :slight_smile:


If you’ve checked that other thread, you’ve seen my analysis of these errors: it’s a token/permissions issue.

How are you making the token available to analysis? By setting a SONAR_TOKEN envvar? If so, can you double-check that it’s properly set? Maybe by temporarily adding printenv or it’s equivalent to your job?


1 Like

Hi Ann! Thanks for the reply.

The issue was on the context being used by my CircleCI project, that’s why the token was not being imported from it.

Thanks for the help!

1 Like