Skip to content

Language autodetection selects a language that has no files in the checkout #4334

Backlog

Description

@therealsamyak

When the languages input is empty, init can autodetect a language that has no files in the checkout. analyze then fails for that language.

Steps to reproduce

  1. Use a repository with only one Python file, plus code in another language.
  2. Run github/codeql-action/init without the languages input.
  3. Delete the Python file, or open a pull request that deletes it.

Expected behavior

The Action analyzes only languages that have source files in the checkout.

Actual behavior

init logs Autodetected languages: python, ..., and analyze fails with exit code 32:

CodeQL detected code written in ..., but not any written in Python.

Cause

getRawLanguagesInRepo in src/config-utils.ts uses only the GET /repos/{owner}/{repo}/languages API. That API reports the default branch's languages and updates in the background, so it does not describe the checked-out commit. #2609 describes the same Linguist behavior.

Activity

  1. jketema commented on Nov 20, 2026

    @jketema

    Hi @therealsamyak,

    Thanks for the report. This is a known limitation, and as you're figuring out on your proposed PR, this is non-trivial to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions