Skip to content
Latchkey

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.

CodeQL
Error: Did not recognize the following languages: 'golang'
Supported languages are: actions, cpp, csharp, go, java, javascript-typescript, python, ruby, swift

Common 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

  1. Use the exact supported language identifiers in the matrix.
  2. Pass languages: ${{ matrix.language }} so init matches the leg.
  3. Guard compiled-language build steps with an if on the matrix language.
.github/workflows/codeql.yml
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 compile

Use 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.

Frequently asked questions

What causes "CodeQL language matrix mismatch"?
Using an alias like golang or typescript instead of the supported identifier (go, javascript-typescript) makes init reject it.
How do I fix CodeQL language matrix mismatch?
Align matrix values with init and gate builds

Related guides

References

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