Skip to content
Latchkey

Deno "fmt --check ... Not formatted" gate failing in CI

deno fmt --check reformats in memory and compares against what is committed. When any file differs, it lists the files and exits non-zero, failing the CI gate without changing anything.

What this error means

The step fails with "error: Found N not formatted files in M files" and lists each file whose formatting differs.

deno
from /home/runner/work/app/app/src/main.ts:

error: Found 1 not formatted file in 42 files

Common causes

Committed code was not formatted

The files were edited without running the formatter, so they differ from deno fmt output.

A fmt config or version difference

A different fmt option in deno.json, or a different Deno version locally, produces output the CI formatter disagrees with.

How to fix it

Format and commit

  1. Run deno fmt to rewrite the files.
  2. Commit the formatting changes.
  3. Re-run deno fmt --check to confirm it passes.
Terminal
deno fmt
deno fmt --check

Align fmt config and Deno version

Keep fmt options in deno.json and pin the same Deno version in CI so local and CI formatting agree.

.github/workflows/ci.yml
- uses: denoland/setup-deno@v2
  with:
    deno-version: v2.x

How to prevent it

  • Run deno fmt before committing, or in a pre-commit hook.
  • Keep fmt options in deno.json under version control.
  • Pin the Deno version so formatter output matches CI.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →