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 filesCommon 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
- Run
deno fmtto rewrite the files. - Commit the formatting changes.
- Re-run
deno fmt --checkto confirm it passes.
Terminal
deno fmt
deno fmt --checkAlign 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.xHow to prevent it
- Run
deno fmtbefore 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
Deno lint failures (deno lint) in CIFix deno lint failures in CI - deno lint reports rule violations that exit non-zero and fail the lint gate.
Deno check TypeScript type errors (TS...) in CIFix Deno "error: TS...." type-check failures in CI - deno check reports TypeScript diagnostics that fail the…
Deno version mismatch between deno.json and CI in CIFix Deno version mismatches in CI - the deno-version installed by setup-deno differs from what your code or d…