Skip to content
Latchkey

CodeQL "No source code was seen during the build" in CI

For compiled languages CodeQL only records files it observes being compiled. If your build step did nothing, used a cache, or skipped compilation, the extractor sees no source and the analysis has nothing to scan.

What this error means

The analyze step fails with "No source code was seen during the build for ..." or "CodeQL did not detect any code written in languages supported by CodeQL". The build itself may have "succeeded".

CodeQL
Error: No source code was seen during the build for the following languages: java.
Please review our troubleshooting guide at https://docs.github.com/code-security ...
CodeQL did not detect any code written in languages supported by CodeQL.

Common causes

The build was a no-op or fully cached

An incremental or cached build recompiled nothing, so the extractor observed no compiler calls and captured no source.

Autobuild ran but did not compile your code

Autobuild built a wrapper, a subproject, or nothing at all, missing the module that holds the real source.

How to fix it

Force a clean, full compile

  1. Disable build caches or incremental builds for the CodeQL job.
  2. Run a clean build that compiles every source file CodeQL should see.
  3. Confirm the analyze step follows the build in the same job.
.github/workflows/codeql.yml
- uses: github/codeql-action/init@v3
  with:
    languages: java
    build-mode: manual
- run: mvn -B -Dmaven.test.skip=true clean compile
- uses: github/codeql-action/analyze@v3

Point the build at the right directory

In a monorepo, run the build from the module that contains the code to scan so the extractor observes those compilations.

.github/workflows/codeql.yml
- run: |
    cd services/api
    ./gradlew --no-build-cache clean compileJava

How to prevent it

  • Always run a clean full compile in the CodeQL job for compiled languages.
  • Disable incremental/cached builds so every file is observed.
  • Verify the analyze step runs in the same job as the build.

Frequently asked questions

What causes ""No source code was seen during the build""?
An incremental or cached build recompiled nothing, so the extractor observed no compiler calls and captured no source.
How do I fix "No source code was seen during the build"?
Force a clean, full compile

Related guides

References

Latchkey auto-heals failures like this one - detected, fixed, and retried without you. Start free → 30-day trial · No credit card