# ERROR: You’re not authorized to run analysis. Please contact the project administrator

**URL:** <https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532>\
**Category:** SonarQube Server / Community Build\
**Tags:** cfamily, scanner\
**Created:** [September 3, 2023, 7:51am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532 "2023-09-03T07:51:06Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![changtheclang](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/changtheclang/32/48834_2.png) [@changtheclang](https://community.sonarsource.com/u/changtheclang)\
**Post date:** [September 3, 2023, 7:51am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/1 "2023-09-03T07:51:07Z")

</div>

Hello,  
I want to scan my c code, and I bought the develope version.  
I used the scanner for the example at first.

> **[GitHub - sonarsource-cfamily-examples/linux-autotools-otherci-sq: An example...](https://github.com/sonarsource-cfamily-examples/linux-autotools-otherci-sq)**
>
> An example C++ repository manually built with GNU Autotools(automake; make) on Linux and analyzed on SonarQube - GitHub - sonarsource-cfamily-examples/linux-autotools-otherci-sq: An example C++ re...

First, I created my test project locally. After I git clone the example, I entered the command

```auto
autoreconf --install
./configure
make clean all
build-wrapper-linux-x86-64 --out-dir bw-output make clean all

```

So far, I think there is no problem. I just followed the step from sonarqube website.  
Then, I entered the command which is also from website

```auto
sonar-scanner \
  -Dsonar.projectKey=test \
  -Dsonar.sources=. \
  -Dsonar.cfamily.build-wrapper-output=bw-output \
  -Dsonar.host.url=http://127.0.0.1:9000 \
  -Dsonar.token=sqp_XXXXXXXXXXXXXXXXXXXXXXXXXX

```

Here is the error  
INFO: Scanner configuration file: /opt/sonar-scanner-5.0.1.3006-linux/conf/sonar-scanner.properties  
INFO: Project root configuration file: /home/cuju/Downloads/linux-autotools-otherci-sq/sonar-project.properties  
INFO: SonarScanner 5.0.1.3006  
INFO: Java 17.0.7 Eclipse Adoptium (64-bit)  
INFO: Linux 5.4.0-37-generic amd64  
INFO: User cache: /home/cuju/.sonar/cache  
INFO: Analyzing on SonarQube server 10.1.0.73491  
INFO: Default locale: “en\_US”, source code encoding: “UTF-8” (analysis is platform dependent)  
INFO: Load global settings  
INFO: Load global settings (done) | time=59ms  
INFO: Server id: 147B411E-AYoTrXwIgxcd6Xxg2U4L  
INFO: User cache: /home/cuju/.sonar/cache  
INFO: Load/download plugins  
INFO: Load plugins index  
INFO: Load plugins index (done) | time=59ms  
INFO: Load/download plugins (done) | time=298ms  
INFO: Loaded core extensions: developer-scanner  
INFO: Process project properties  
INFO: Process project properties (done) | time=52ms  
INFO: Execute project builders  
INFO: Execute project builders (done) | time=1ms  
INFO: Project key: test  
INFO: Base dir: /home/cuju/Downloads/linux-autotools-otherci-sq  
INFO: Working dir: /home/cuju/Downloads/linux-autotools-otherci-sq/.scannerwork  
INFO: Load project settings for component key: ‘test’  
INFO: ------------------------------------------------------------------------  
INFO: EXECUTION FAILURE  
INFO: ------------------------------------------------------------------------  
INFO: Total time: 1.895s  
INFO: Final Memory: 16M/80M  
INFO: ------------------------------------------------------------------------  
ERROR: Error during SonarScanner execution  
ERROR: You’re not authorized to analyze this project or the project doesn’t exist on SonarQube and you’re not authorized to create it. Please contact an administrator.  
ERROR:  
ERROR: Re-run SonarScanner using the -X switch to enable full debug logging.

I have opened all of the permission in my project setting, and I already used my license.  
How do I solve the error?

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [September 4, 2023, 7:56am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/2 "2023-09-04T07:56:35Z")

</div>

Hey there.

Can you try wrapping your SonarQube URL in quotation marks?

```auto
sonar-scanner \
  -Dsonar.projectKey=test \
  -Dsonar.sources=. \
  -Dsonar.cfamily.build-wrapper-output=bw-output \
  -Dsonar.host.url="http://127.0.0.1:9000" \
  -Dsonar.token=sqp_XXXXXXXXXXXXXXXXXXXXXXXXXX

```

---

<div class="post-metadata">

**Author:** ![changtheclang](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/changtheclang/32/48834_2.png) [@changtheclang](https://community.sonarsource.com/u/changtheclang)\
**Post date:** [September 5, 2023, 9:31am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/4 "2023-09-05T09:31:02Z")

</div>

Hello.  
I have tried to add the quotation marks.  
It seems the error is still.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [September 5, 2023, 3:48pm UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/5 "2023-09-05T15:48:26Z")

</div>

Hm. Can you try removing all the line breaks?

`sonar-scanner -Dsonar.projectKey=test -Dsonar.sources=. -Dsonar.cfamily.build-wrapper-output=bw-output -Dsonar.host.url=http://127.0.0.1:9000 -Dsonar.token=sqp_XXXXXXXXXXXXXXXXXXXXXXXXXX`

---

<div class="post-metadata">

**Author:** ![changtheclang](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/changtheclang/32/48834_2.png) [@changtheclang](https://community.sonarsource.com/u/changtheclang)\
**Post date:** [September 5, 2023, 4:50pm UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/6 "2023-09-05T16:50:24Z")

</div>

Hi.  
I also tried without all the line breaks.  
But it doesn’t change the result.

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [September 6, 2023, 2:45pm UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/7 "2023-09-06T14:45:31Z")

</div>

Okay. So it sounds like a real permissions issue with the token that’s being used.

Does a project with the key `test` already exist on SonarQube?

---

<div class="post-metadata">

**Author:** ![changtheclang](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/changtheclang/32/48834_2.png) [@changtheclang](https://community.sonarsource.com/u/changtheclang)\
**Post date:** [September 6, 2023, 3:06pm UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/8 "2023-09-06T15:06:13Z")

</div>

Yes, it seems like a real permissions issue with the token that’s being used.  
I have created the project manuallyfrom the localhost:9000.  
The project display name is test, and the project key is also test.

 ![image](https://europe1.discourse-cdn.com/sonarsource/uploads/sonarcommunity/original/3X/b/6/b6bc4832bbad329f160c3061fea25e21aac65a61.png)

Is there any command using the sonar.sh or sonar-scanner to check the test existing or not?

---

<div class="post-metadata">

**Author:** ![changtheclang](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/changtheclang/32/48834_2.png) [@changtheclang](https://community.sonarsource.com/u/changtheclang)\
**Post date:** [September 12, 2023, 12:25pm UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/9 "2023-09-12T12:25:39Z")

</div>

Does anyone have the same situation?

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [September 13, 2023, 3:11pm UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/10 "2023-09-13T15:11:29Z")

</div>

That’s really weird that it’s not working out of the box. I can’t reproduce it. Let’s try something else.

Can you go to **My Account \> Security** and generate a new token (a user token or a global analysis token) and see if it works in place of the project token that was generated?

---

<div class="post-metadata">

**Author:** ![Andy\_Evans](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andy_evans/32/46712_2.png) [@Andy\_Evans](https://community.sonarsource.com/u/Andy_Evans)\
**Post date:** [September 14, 2023, 4:34am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/11 "2023-09-14T04:34:18Z")

</div>

I seem to be having this same issue. I’ve tried creating a different PAT but still received the same error. I tried creating a new user with permission to run analysis and create projects but still received the same error. I’m running the Enterprise version.

---

<div class="post-metadata">

**Author:** ![changtheclang](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/changtheclang/32/48834_2.png) [@changtheclang](https://community.sonarsource.com/u/changtheclang)\
**Post date:** [September 14, 2023, 6:32am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/12 "2023-09-14T06:32:05Z")

</div>

Okay, I figure it out. I finally can analyze the c-family example.  
The problem come from the project token.  
I chose the option [Use existing token] before because it is convenient to use the same token.  
I chose the other option [Generate a project token] to generate a new token.  
I run the command from the website and the analysis runs successfully.  
INFO: Analysis total time: 15.888 s  
INFO: ------------------------------------------------------------------------  
INFO: EXECUTION SUCCESS  
INFO: ------------------------------------------------------------------------  
INFO: Total time: 17.556s  
INFO: Final Memory: 34M/128M  
INFO: ------------------------------------------------------------------------

Thanks for your assistance!

---

<div class="post-metadata">

**Author:** ![Colin](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/colin/32/55255_2.png) [@Colin](https://community.sonarsource.com/u/Colin)\
**Post date:** [September 14, 2023, 9:13am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/13 "2023-09-14T09:13:06Z")

</div>

> [@changtheclang](#):
>
> I chose the option [Use existing token] before because it is convenient to use the same token.

Thanks for the update. [Project analysis tokens](https://docs.sonarsource.com/sonarqube/latest/user-guide/user-account/generating-and-using-tokens/#project-analysis-tokens) are project specific and can’t be used for other projects.

---

<div class="post-metadata">

**Author:** ![Andy\_Evans](https://dub1.discourse-cdn.com/sonarsource/user_avatar/community.sonarsource.com/andy_evans/32/46712_2.png) [@Andy\_Evans](https://community.sonarsource.com/u/Andy_Evans)\
**Post date:** [September 15, 2023, 1:48am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/14 "2023-09-15T01:48:17Z")

</div>

It turns out my issue was unrelated. A Firewall was returning a 403 status code on only the api/ce/submit endpoint. The client interpreted the 403 as coming from the server and returned the error above. After updating the firewall the error went away.

EDIT:  
See here. It just checks the code without examining the body.

> <https://github.com/SonarSource/sonarqube/blob/40ed04f6b3f5f95749c35ccc88e2dc94137efbba/sonar-scanner-engine/src/main/java/org/sonar/scanner/bootstrap/DefaultScannerWsClient.java#L119>

---

<div class="post-metadata">

**Author:** ![deepika.singh](https://avatars.discourse-cdn.com/v4/letter/d/f05b48/32.png) [@deepika.singh](https://community.sonarsource.com/u/deepika.singh)\
**Post date:** [December 6, 2023, 8:32am UTC](https://community.sonarsource.com/t/error-you-re-not-authorized-to-run-analysis-please-contact-the-project-administrator/98532/15 "2023-12-06T08:32:03Z")

</div>

Hello Team ,

When I automate the sonarqube with jenkins getting below error

Jenkinfile mentioned

stage(‘Sonar analysing’) {  
steps {  
withSonarQubeEnv(‘global-sonar’) {  
script {  
rtGradle.run rootDir: “”, buildFile: ‘build.gradle’, tasks: ‘–info sonarqube’, buildInfo: buildInfo  
}  
sh “./gradlew --info --scan --stacktrace sonarqube”

```
            }       
        }
    }

```

In above stage getting error

FAILURE: Build failed with an exception.

- What went wrong:  
Execution failed for task ‘:sonarqube’.

> You’re not authorized to run analysis. Please contact the project administrator.

- Try:  
Run with --debug option to get more log output. Run with --scan to get full insights.

- Exception is:  
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ‘:sonarqube’.  
at
