Really confusing error (Could not find a default branch to fall back on): call for improvement

Hi there,

trying to integrate SonarCloud with Aure DevOps via yaml pipelines. And getting this “nice” error for step “SonarCloudAnalyze”:

Could not find a default branch to fall back on.

Yesterday I spend several hours trying to fix. You know, what was the issue? I had a project key: Xxx_xxx_xxx but in the step in the parameter I have entered xxx_xxx_xxx. Where was the difference? in the casing!

What was the error? See above.

Log?
2021-03-23T18:24:17.0078206Z INFO: Load project branches
2021-03-23T18:24:17.0265122Z INFO: Load project branches (done) | time=18ms
2021-03-23T18:24:17.0306985Z INFO: Check ALM binding of project ‘xxx_xxx_xxx’
2021-03-23T18:24:17.0456819Z INFO: Detected project binding: NONEXISTENT
2021-03-23T18:24:17.0470756Z INFO: Check ALM binding of project ‘xxx_xxx_xxx’ (done) | time=16ms
2021-03-23T18:24:17.0487307Z INFO: Load project pull requests
2021-03-23T18:24:17.0696879Z INFO: Load project pull requests (done) | time=21ms
2021-03-23T18:24:17.0752671Z INFO: Load branch configuration
2021-03-23T18:24:17.0833846Z INFO: ------------------------------------------------------------------------
2021-03-23T18:24:17.0837860Z INFO: EXECUTION FAILURE
2021-03-23T18:24:17.0841273Z INFO: ------------------------------------------------------------------------
2021-03-23T18:24:17.0845952Z INFO: Total time: 21.313s
2021-03-23T18:24:17.1199233Z INFO: Final Memory: 7M/27M
2021-03-23T18:24:17.1200747Z INFO: ------------------------------------------------------------------------
2021-03-23T18:24:17.1202284Z ##[error]ERROR: Error during SonarScanner execution
ERROR: Could not find a default branch to fall back on.
ERROR:
2021-03-23T18:24:17.1203809Z ERROR: Error during SonarScanner execution
2021-03-23T18:24:17.1204416Z ERROR: Could not find a default branch to fall back on.
2021-03-23T18:24:17.1205047Z ERROR:
2021-03-23T18:24:17.1640841Z ##[error]The SonarScanner did not complete successfully

The only indication something was wrong with the project key was INFO line

Detected project binding: NONEXISTENT

So what is the suggestiong? Definitely propagating the real issue to the error message. How bout following error:

Could not find a default branch to fall back on:
Project with key '“xxx_xxxx” not found.

Of course the detailed error should be related to the issue, so I would expect if the issue is with PAT token, then this should be “visible” in the error.

This would really improve the user experience and it would reduce the user confusion!

2 Likes

anyone

Hey @jvilimek ,
Thank you for your contribution :slight_smile:
This would be indeed a nice improvement.
Let’s keep it here and see if it attracts some votes :slight_smile:

Thanks!
Kind regards,
Christophe