False positive — CodeQL failing due to lack of Python files when they only exist on the `main` branch
- Lenguaje dominante
- CodeQL
- Estrellas
- 10.1k
- Forks
- 2.1k
- Merge medio
- 2 d 15 h
- PR fusionados (30 d)
- 141
Descripción
**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.
Guía de contribución
Línea de trabajo
Reproduce the failure with a pull request whose older base lacks Python while main contains a script in scripts/. Start with the CodeQL database finalization error and the linked no-source-code troubleshooting guide; done means a valid pull request does not fail solely because Python exists only on main.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Área
- security
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Necesita aclaración
- Aptitud para principiantes
- 25/100