Cache post job cleanup warning following sonarscanner for .net example

Must-share information (formatted with Markdown):

  • which versions are you using Scanner
  • how is SonarQube deployed: Helm
  • what are you trying to achieve: Run scan via GitHub workflow
  • what have you tried so far to achieve this: Follow example provided for .Net scans at: GitHub integration (

First attempt at running SonarQube scanner in a GitHub workflow. I noticed the post cache processing is throwing a warning:

Post job cleanup.
C:\Windows\System32\tar.exe -cz -f D:/a/_temp/4531dcae-9e9c-4a0d-97b9-8d1b5060e60c/cache.tgz -C C:/Users/runneradmin/sonar/cache .
tar.exe: could not chdir to 'C:/Users/runneradmin/sonar/cache' 
Warning: Tar failed with error: The process 'C:\Windows\System32\tar.exe' failed with exit code 1

I changed the path from “~\sonar\cache” to “..sonar\cache” and resolved the warning, but wondering if the warning implies that something is not set up with proper permissions?


Welcome to the community!

Ehm… We create that directory purely for the scanner’s use, with no expectation that you’ll want to or need to do anything with it afterward.

Could you explain what you are trying to do? It looks like you archive the build directory after the job…? If so, would you mind explaining why?


Hi Ann,

I’m not attempting to use the directory. These look like implicitly added cache cleanup steps. I added the “SonarScanner for .NET” example code from the link above with no modifications. After the “Build and Analyze” step (the last step explicitly defined) I see two additional steps: “Post Cache SonarQube scanner”, and “Post Cache SonarQube packages”.

Maybe I should be posting this under the actions/cache repo instead. I was curious if anyone else was having the same issue with that example.


Would you mind sharing your yaml file, redacted as necessary?


See below. In order to repro this I have to clear the repo cache each time.

name: SonarQube Analysis

name: Build
runs-on: windows-latest
- name: Set up JDK 17
uses: actions/setup-java@v1
java-version: 1.17

  - uses: actions/checkout@v3
      ref: jdh-484121

  - name: Cache SonarQube packages
    uses: actions/cache@v1
      path: ~\sonar\cache
      key: ${{ runner.os }}-sonar
      restore-keys: ${{ runner.os }}-sonar

  - name: Cache SonarQube scanner
    id: cache-sonar-scanner
    uses: actions/cache@v1
      path: .\.sonar\scanner
      key: ${{ runner.os }}-sonar-scanner
      restore-keys: ${{ runner.os }}-sonar-scanner

  - name: Install SonarQube scanner
    if: steps.cache-sonar-scanner.outputs.cache-hit != 'true'
    shell: powershell
    run: |
      New-Item -Path .\.sonar\scanner -ItemType Directory
      dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner

  - name: Build and analyze
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
    shell: powershell
    run: |
      .\.sonar\scanner\dotnet-sonarscanner begin /k:"redacted" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /"${{ secrets.SONARQUBE_HOST_URL }}"
      dotnet build

  - name: End Scan
    if: always()
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}  # Needed to get PR information, if any
    shell: powershell
    run: |
      .\.sonar\scanner\dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONARQUBE_GLOBAL_ANALYSIS_TOKEN }}"


Thanks for the pipeline.

Looking back, I misread your initial post. we create the .sonar directory for scanner use. Sorry for the confusion.

You’re having trouble with the .../sonar/cache directory. It looks like that’s created by your caching step:


Correct, the issue is with the caching step. I’m using the “SonarScanner for .Net” example found here: GitHub integration ( which includes the caching step.

I was hoping someone could attempt to repro and let me know the results either in a new repo or after clearing the cache. If it’s reproducible the example should be updated.

1 Like

Hi @jdholbrook,

This is a typo in our documentation. The path should be ~/.sonar/cache, not ~/sonar/cache (notice the period . in front of .sonar). We’ll update the docs ASAP and fix the in-app tutorials.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.