CodeQL matrix language / config mismatch in CI
CodeQL workflows commonly fan out one job per language via a matrix. If the matrix value does not match the languages input, or a build step runs for the wrong matrix leg, analysis fails or scans nothing.
What this error means
A matrix leg fails because init receives an unexpected language, a compiled-language build runs during an interpreted leg, or the same language is analyzed twice with conflicting configs.
Error: Did not recognize the following languages: 'golang'
Supported languages are: actions, cpp, csharp, go, java, javascript-typescript, python, ruby, swiftCommon causes
The matrix value is not a valid CodeQL language
Using an alias like golang or typescript instead of the supported identifier (go, javascript-typescript) makes init reject it.
A build step runs for the wrong matrix leg
A compiled-language build (Maven, Gradle) runs on the Python or JavaScript leg, wasting time or failing that job.
How to fix it
Align matrix values with init and gate builds
- Use the exact supported language identifiers in the matrix.
- Pass
languages: ${{ matrix.language }}so init matches the leg. - Guard compiled-language build steps with an
ifon the matrix language.
strategy:
matrix:
language: [java, javascript-typescript, python]
steps:
- uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- if: matrix.language == 'java'
run: mvn -B clean compileUse the canonical language identifiers
Replace aliases: go (not golang), javascript-typescript (not typescript), csharp (not c#).
How to prevent it
- List only supported CodeQL language identifiers in the matrix.
- Drive init and build gating from the matrix value.
- Keep one language per matrix leg to isolate failures.