scalafmt check failed in CI
scalafmt ran in check mode and found files that do not match the configured formatting. This is a style gate, not a compile failure.
What this error means
The CI step fails with a list of files that are not formatted, telling you to run scalafmt. It is deterministic given the sources and .scalafmt.conf.
[error] /src/main/scala/App.scala isn't formatted properly!
[error] --- a/src/main/scala/App.scala
[error] +++ b/src/main/scala/App.scala
[error] scalafmt: 1 files must be formattedCommon causes
Code committed without formatting
A change was pushed without running scalafmt, so the files diverge from the configured style.
scalafmt version or config drift
A different scalafmt version (or a changed .scalafmt.conf) formats differently than what produced the committed code, so CI flags files that look fine locally.
How to fix it
Format the sources
Run scalafmt to rewrite files to the configured style, then commit.
sbt scalafmtAll scalafmtSbtPin the scalafmt version
- Set the exact version in .scalafmt.conf with
version = "...". - Use the same version locally and in CI.
- Run a format-on-save or pre-commit hook to stay in sync.
How to prevent it
- Pin the scalafmt version in .scalafmt.conf.
- Add a pre-commit or format-on-save hook.
- Run scalafmtCheckAll locally before pushing.