Skip to content
Latchkey

CodeQL "No space left on device" during analysis in CI

CodeQL writes a large database plus query packs to disk. On a runner with limited free space, extraction or analysis can fill the volume and fail with "No space left on device".

What this error means

The CodeQL step fails with "No space left on device" or "ENOSPC" while creating the database or running queries, often on a runner already loaded with a build.

CodeQL
Error: Encountered a fatal error while running "codeql database create".
IOException: No space left on device (write failed)

Common causes

The build already consumed most of the disk

A large checkout, dependency cache, and build artifacts leave little room for the CodeQL database and packs.

The database itself is large

Big codebases produce multi-gigabyte databases; combined with query pack downloads this can exceed free space.

How to fix it

Free disk before the CodeQL step

Remove unused toolchains and caches on the runner to reclaim space before extraction.

.github/workflows/codeql.yml
- name: Free disk space
  run: |
    sudo rm -rf /usr/share/dotnet /opt/ghc "$AGENT_TOOLSDIRECTORY"
    df -h /

Run CodeQL on a larger-disk runner

Use a runner with more disk, or isolate CodeQL in its own job so it does not compete with build artifacts.

How to prevent it

  • Isolate CodeQL in a dedicated job with a clean workspace.
  • Free unused toolchains and caches before extraction.
  • Use a larger runner for big codebases.

Frequently asked questions

What causes ""No space left on device" (CodeQL)"?
A large checkout, dependency cache, and build artifacts leave little room for the CodeQL database and packs.
How do I fix "No space left on device" (CodeQL)?
Remove unused toolchains and caches on the runner to reclaim space before extraction.

Related guides

References

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