jdx/mise · error

Following config files are not properly formatted: {}

Error message

Following config files are not properly formatted:
{}

What it means

`mise fmt --check` reformats each config in memory (custom key sorting via toml_edit plus taplo formatting) and compares it to what is on disk; every file whose canonical form differs is listed and the command exits non-zero without writing anything. It is mise's format-check gate for CI and pre-commit.

Source

Thrown at src/cli/fmt.rs:73

                .is_some_and(|f| f.to_string_lossy().ends_with("toml"))
            {
                continue;
            }
            let source = file::read_to_string(&p)?;
            let toml = source.clone();
            let toml = sort(toml)?;
            let toml = format(toml)?;
            if self.check {
                if source != toml {
                    errors.push(p.display().to_string());
                }
                continue;
            }
            file::write(&p, &toml)?;
        }

        if !errors.is_empty() {
            bail!(
                "Following config files are not properly formatted:\n{}",
                errors.join("\n")
            );
        }

        Ok(())
    }
}

fn sort(toml: String) -> Result<String> {
    let mut doc: toml_edit::DocumentMut = toml.parse()?;
    let order = |k: String| match k.as_str() {
        "min_version" => 0,
        "env_file" => 1,
        "env_path" => 2,
        "_" => 3,
        "env" => 4,
        "vars" => 5,

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Run `mise fmt` (no --check) to rewrite the listed files into canonical form, then commit
  2. Pipe generated configs through `mise fmt --stdin` inside your generator so they are born canonical
  3. Install the project's pre-commit hook (hk/mise fmt) so the check can never see unformatted files
  4. In CI, show the diff on failure (`git diff` after a fixing `mise fmt` run) to speed up review

Example fix

# before (CI)
- run: mise fmt --check   # fails, lists mise.toml

# after (developer machine)
mise fmt
git commit -am "style: mise fmt"
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/bash
# canonicalize first so the check is a pure gate
mise fmt
mise fmt --check

Try / catch

if ! mise fmt --check; then
  echo 'configs need formatting — run `mise fmt` and commit' >&2
  mise fmt
  git diff --stat -- '*mise*.toml'
  exit 1
fi

Prevention

When it happens

Trigger: Running `mise fmt --check` on configs that were hand-edited, merged, or emitted by a generator with non-canonical key order or spacing.

Common situations: A teammate merges mise.toml changes without running fmt locally; CI added the check before contributors got the pre-commit hook; config generated by a script with unsorted keys.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/7f1f6d1ec7e34e7c. Report an issue: GitHub.