Skip to content

False positive — CodeQL failing due to lack of Python files when they only exist on the main branch #21106

@andrzej-pomirski-yohana

Description

@andrzej-pomirski-yohana

Description of the false positive

Hi, I encountered a weird issue with CodeQL. My pull request is based on a slightly older version of the codebase, which did not have any Python files. However, there is now a single Python file in main. CodeQL runs, but fails due to lack of Python files, which blocks a perfectly valid PR.

Unfortunately, the code is private, so I am not able to share the repository, but the main branch contains a Python script in scripts/, while the PR version of the codebase doesn't.

The exact error is

 /opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/codeql database finalize --finalize-dataset --threads=2 --ram=6920 /home/runner/work/_temp/codeql_databases/python
  CodeQL detected code written in C/C++, Swift, GitHub Actions and Java/Kotlin, but not any written in Python. Confirm that there is some source code for Python in the project. For more information, review our troubleshooting guide at https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build .
  Error: Encountered a fatal error while running "/opt/hostedtoolcache/CodeQL/2.23.8/x64/codeql/codeql database finalize --finalize-dataset --threads=2 --ram=6920 /home/runner/work/_temp/codeql_databases/python". Exit code was 32 and last log line was: CodeQL detected code written in C/C++, Swift, GitHub Actions and Java/Kotlin, but not any written in Python. Confirm that there is some source code for Python in the project. For more information, review our troubleshooting guide at https://gh.io/troubleshooting-code-scanning/no-source-code-seen-during-build . See the logs for more details.

I don't believe that CodeQL should be configured to run on file types that do not exist on a given branch. This can be fixed in a pretty simple way — rebasing the branch on top of HEAD, but still, I don't believe this should be a cause for failure in the first place.

Metadata

Metadata

Assignees

No one assigned

    Labels

    acknowledgedGitHub staff acknowledges this issuebugSomething isn't workingfalse-positive

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions