Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close

Run github/codeql-action/init@v1
    languages: csharp
    token: ***
    matrix: {
    "language": "csharp"
    setup-python-dependencies: true
Setup CodeQL tools
  Looked for CodeQL bundle in github/codeql-action on ********* but got error HttpError: Not Found.
  Downloading CodeQL tools from This may take a while.
  (node:61312) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
  Premature close
  Waiting 17 seconds before trying again
  Premature close
  Waiting 17 seconds before trying again
  Error: Error [ERR_STREAM_PREMATURE_CLOSE]: Premature close
  Error: Unable to download and extract CodeQL CLI
  Error: Unable to download and extract CodeQL CLI
      at Object.setupCodeQL (D:\Projects\ODIP\actions-runner\_work\_actions\github\codeql-action\v1\lib\codeql.js:236:15)

Please provide solution for this error.

Thank you for your question. It looks like the default codeql bundle was not available locally in the runner for some reason. And then, the action was unable to download it from

Are you using a self-hosted runner? Make sure the runner has access to the internet, or at least access to

Would you be able to share your full workflow (sanitized)? If you don’t want to share it publicly, then you can email it to me directly. (aeisenberg [at]

Yes, We are using self-hosted runner. and runner has access to the internet. From runner machine, We can download codeQL bundle in browser.

Please find workflow file-

name: "CodeQL"

    branches: [ main ]
    # The branches below must be a subset of the branches above
    branches: [ main ]
    - cron: '42 22 * * 2'

    name: Analyze
    runs-on: [ self-hosted ]

      fail-fast: false
        language: ['csharp']
        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
        # Learn more:

    - name: Checkout repository
      uses: actions/checkout@v2

    # Initializes the CodeQL tools for scanning.
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v1
        languages: ${{ matrix.language }}
        debug: true
        # If you wish to specify custom queries, you can do so here or in a config file.
        # By default, queries listed here will override any specified in a config file.
        # Prefix the list here with "+" to use these queries and those in the config file.
        # queries: ./path/to/local/query, your-org/your-repo/queries@main

    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
    # If this step fails, then you should remove it and run the build manually (see below)
    ##- if: matrix.language == 'cpp' || matrix.language == 'csharp'
    #  name: Autobuild
    #  uses: github/codeql-action/autobuild@v1

    # ℹ️ Command-line programs to run using the OS shell.
    # 📚

    # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
    #    and modify them (or add more) to build your code if your project
    #    uses a compiled language

    #- run: |
    #   make bootstrap
    #   make release

    - name: Setup .NET
      uses: actions/setup-dotnet@v1
        dotnet-version: 5.0.x
    - name: Restore dependencies
      run: dotnet restore ./??????.sln
    - name: Build
      run: dotnet build ./??????.sln --no-restore
    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v1

The NODE_TLS_REJECT_UNAUTHORIZED set to 0 indicates that the runner does not have the correct root CA certificates installed and the machine is configured to avoid checking for invalid certs. It may be that this is what is causing the failures.

Can you make sure that all the SSL certs on the machine are properly configured?

rather than ignoring ssl, now we have configured it in machine and now we are getting below error -

It looks like there is still some sort of configuration problem, but I am not sure what the issue. Can you enable debug logging in your actions run and post anything interesting here?