Github Action Failing "No such file or directory"

We are running the GitHub Action SonarSource/sonarqube-scan-action on our self hosted Windows Server build agent.

The actions fails in Run ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh step:

Run SonarSource/sonarqube-scan-action@v5
  with:
    scannerVersion: 7.1.0.4889
    scannerBinariesUrl: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
  env:
    SONAR_HOST_URL: ***
    SONAR_TOKEN: ***
  
Run ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh
  ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh
  shell: C:\Windows\system32\bash.EXE --noprofile --norc -e -o pipefail {0}
  env:
    SONAR_HOST_URL: ***
    SONAR_TOKEN: ***
    INPUT_PROJECTBASEDIR: 
    INPUT_SCANNERVERSION: 7.1.0.4889
  
/bin/bash: C:github-runnerdeploy-3_work_tempc6899ac9-c9ff-4e81-b652-767ae275270c.sh: No such file or directory
Error: Process completed with exit code 1.

Workflow definition:

  sonarqube-scan:
    runs-on:
      - self-hosted
    needs: build-test
    steps:
      - name: Checkout
        uses: actions/checkout@v4
        with:
          fetch-depth: 0 
      - name: Download code coverage report
        uses: actions/download-artifact@v4
        with:
          name: coverage-report

      - name: SonarQube Scan
        uses: SonarSource/sonarqube-scan-action@v5
        env:
          SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
          SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}

Anything I’m missing here?

Hey @flecamos

I think the issue must be somewhere in your self-hosted runner. Here are the logs from my run using windows-latest

2025-05-30T07:10:41.0400793Z ##[group]Run SonarSource/sonarqube-scan-action@v5
2025-05-30T07:10:41.0401434Z with:
2025-05-30T07:10:41.0401648Z   scannerVersion: 7.1.0.4889
2025-05-30T07:10:41.0402039Z   scannerBinariesUrl: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
2025-05-30T07:10:41.0403163Z env:
2025-05-30T07:10:41.0403529Z   SONAR_HOST_URL: ***
2025-05-30T07:10:41.0404050Z   SONAR_TOKEN: ***
2025-05-30T07:10:41.0404227Z ##[endgroup]
2025-05-30T07:10:41.0586228Z ##[group]Run ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh
2025-05-30T07:10:41.0586677Z e[36;1m${GITHUB_ACTION_PATH}/scripts/sanity-checks.she[0m
2025-05-30T07:10:41.0602505Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2025-05-30T07:10:41.0602867Z env:
2025-05-30T07:10:41.0603163Z   SONAR_HOST_URL: ***
2025-05-30T07:10:41.0603425Z   SONAR_TOKEN: ***
2025-05-30T07:10:41.0603604Z   INPUT_PROJECTBASEDIR: 
2025-05-30T07:10:41.0603820Z   INPUT_SCANNERVERSION: 7.1.0.4889
2025-05-30T07:10:41.0604088Z ##[endgroup]
2025-05-30T07:10:41.3687108Z ##[group]Run actions/cache@v4
2025-05-30T07:10:41.3687338Z with:
2025-05-30T07:10:41.3687565Z   path: D:\a\_temp/sonar-scanner-cli-7.1.0.4889-Windows-X64
2025-05-30T07:10:41.3687889Z   key: sonar-scanner-cli-7.1.0.4889-Windows-X64
2025-05-30T07:10:41.3688147Z   enableCrossOsArchive: false
2025-05-30T07:10:41.3688353Z   fail-on-cache-miss: false
2025-05-30T07:10:41.3688537Z   lookup-only: false
2025-05-30T07:10:41.3688709Z   save-always: false
2025-05-30T07:10:41.3689156Z env:
2025-05-30T07:10:41.3689496Z   SONAR_HOST_URL: ***
2025-05-30T07:10:41.3689744Z   SONAR_TOKEN: ***
2025-05-30T07:10:41.3689929Z   SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
2025-05-30T07:10:41.3690139Z ##[endgroup]
2025-05-30T07:10:42.1084430Z Cache not found for input keys: sonar-scanner-cli-7.1.0.4889-Windows-X64
2025-05-30T07:10:42.1366989Z ##[group]Run ${GITHUB_ACTION_PATH}/scripts/install-sonar-scanner-cli.sh
2025-05-30T07:10:42.1367456Z e[36;1m${GITHUB_ACTION_PATH}/scripts/install-sonar-scanner-cli.she[0m
2025-05-30T07:10:42.1378129Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2025-05-30T07:10:42.1378483Z env:
2025-05-30T07:10:42.1378840Z   SONAR_HOST_URL: ***
2025-05-30T07:10:42.1379123Z   SONAR_TOKEN: ***
2025-05-30T07:10:42.1379306Z   INPUT_SCANNERVERSION: 7.1.0.4889
2025-05-30T07:10:42.1379702Z   INPUT_SCANNERBINARIESURL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
2025-05-30T07:10:42.1380095Z ##[endgroup]
2025-05-30T07:10:42.1835318Z + mkdir -p 'D:\a\_temp/sonarscanner'
2025-05-30T07:10:42.2070940Z + cd 'D:\a\_temp/sonarscanner'
2025-05-30T07:10:42.2074176Z + SCANNER_FILE_NAME=sonar-scanner-cli-7.1.0.4889-windows-x64.zip
2025-05-30T07:10:42.2077057Z + SCANNER_URI=https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.1.0.4889-windows-x64.zip
2025-05-30T07:10:42.2078041Z + command -v wget
2025-05-30T07:10:42.2166197Z + command -v curl
2025-05-30T07:10:42.2172926Z + curl --fail --silent --show-error --user-agent sonarqube-scan-action --location --output sonar-scanner-cli-7.1.0.4889-windows-x64.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-7.1.0.4889-windows-x64.zip
2025-05-30T07:10:43.5526023Z + unzip -q -o sonar-scanner-cli-7.1.0.4889-windows-x64.zip
2025-05-30T07:10:44.9011553Z + SCANNER_UNZIP_FOLDER=sonar-scanner-7.1.0.4889-windows-x64
2025-05-30T07:10:44.9012279Z + SCANNER_LOCAL_FOLDER='D:\a\_temp/sonar-scanner-cli-7.1.0.4889-Windows-X64'
2025-05-30T07:10:44.9012940Z + '[' -d 'D:\a\_temp/sonar-scanner-cli-7.1.0.4889-Windows-X64' ']'
2025-05-30T07:10:44.9014417Z + mv -f sonar-scanner-7.1.0.4889-windows-x64 'D:\a\_temp/sonar-scanner-cli-7.1.0.4889-Windows-X64'
2025-05-30T07:10:45.0108388Z ##[group]Run echo "${RUNNER_TEMP}/sonar-scanner-cli-7.1.0.4889-Windows-X64/bin" >> $GITHUB_PATH
2025-05-30T07:10:45.0109473Z e[36;1mecho "${RUNNER_TEMP}/sonar-scanner-cli-7.1.0.4889-Windows-X64/bin" >> $GITHUB_PATHe[0m
2025-05-30T07:10:45.0122196Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2025-05-30T07:10:45.0122659Z env:
2025-05-30T07:10:45.0122983Z   SONAR_HOST_URL: ***
2025-05-30T07:10:45.0123237Z   SONAR_TOKEN: ***
2025-05-30T07:10:45.0123570Z ##[endgroup]
2025-05-30T07:10:45.0494127Z ##[group]Run args=()
2025-05-30T07:10:45.0494332Z e[36;1margs=()e[0m
2025-05-30T07:10:45.0494616Z e[36;1mcmd=(${GITHUB_ACTION_PATH}/scripts/run-sonar-scanner-cli.sh "${args[@]}")e[0m
2025-05-30T07:10:45.0494945Z e[36;1m"${cmd[@]}"e[0m
2025-05-30T07:10:45.0507759Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
2025-05-30T07:10:45.0508108Z env:
2025-05-30T07:10:45.0508540Z   SONAR_HOST_URL: ***
2025-05-30T07:10:45.0508794Z   SONAR_TOKEN: ***
2025-05-30T07:10:45.0508965Z   INPUT_PROJECTBASEDIR: 
2025-05-30T07:10:45.0509257Z   SONAR_SCANNER_JRE: D:\a\_temp/sonar-scanner-cli-7.1.0.4889-Windows-X64/jre
2025-05-30T07:10:45.0509578Z ##[endgroup]
2025-05-30T07:10:45.1042639Z + sonar-scanner.bat
2025-05-30T07:10:45.5173371Z 07:10:45.505 INFO  Scanner configuration file: D:\a\_temp\sonar-scanner-cli-7.1.0.4889-Windows-X64\bin\..\conf\sonar-scanner.properties
2025-05-30T07:10:45.5182207Z 07:10:45.505 INFO  Project root configuration file: D:\a\python-flask-demo\python-flask-demo\sonar-project.properties
2025-05-30T07:10:45.5363029Z 07:10:45.521 INFO  SonarScanner CLI 7.1.0.4889
2025-05-30T07:10:45.5382532Z 07:10:45.537 INFO  Java 17.0.13 Eclipse Adoptium (64-bit)
2025-05-30T07:10:45.5388558Z 07:10:45.537 INFO  Windows Server 2022 10.0 amd64

I noticed that my run uses a different shell.

2025-05-30T07:10:42.1378129Z shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}

Compared to you:

Do you have the option to adjust the default shell on your self-hosted runner (this is not my area of expertise)?

1 Like

Hey @Colin

Thanks for pointing out this detail!

We had Windows Subsystem for Linux / WSL also installed on this particular build machine. And this comes with a different bash.exe located in C:\Windows\system32\

Removing WSL, adding C:\Program Files\Git\bin to the PATH env variable, a server reboot and the action finally picks up the correct bash.exe

Run SonarSource/sonarqube-scan-action@master
  with:
    projectBaseDir: apps/shell
    scannerVersion: 7.1.0.4889
    scannerBinariesUrl: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
    SONAR_HOST_URL: ***
    SONAR_TOKEN: ***
Run ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh
  ${GITHUB_ACTION_PATH}/scripts/sanity-checks.sh
  shell: C:\Program Files\Git\bin\bash.EXE --noprofile --norc -e -o pipefail {0}
    SONAR_HOST_URL: ***
    SONAR_TOKEN: ***
    INPUT_PROJECTBASEDIR: apps/shell
    INPUT_SCANNERVERSION: 7.1.0.4889
1 Like

Great thank you for following up! Glad it’s working now.

To be honest I’m not sure which bash should be used, but I guess I rely on the Github-hosted runners to be using a good one. :smiley:

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