jdx/mise · error

No config file found in current directory

Error message

No config file found in current directory

What it means

`mise fmt` collects mise TOML config files from the current directory (mise.toml, .mise.toml, mise.local.toml, ...) and found none, so there is nothing to format and the command aborts. Without `--all` it only looks at configs rooted at cwd, not at everything mise has loaded globally.

Source

Thrown at src/cli/fmt.rs:49

            let mut toml = String::new();
            io::stdin().read_to_string(&mut toml)?;

            let toml = sort(toml)?;
            let toml = format(toml)?;
            let mut stdout = io::stdout();
            write!(stdout, "{toml}")?;

            return Ok(());
        }

        let cwd = dirs::CWD.clone().unwrap_or_default();
        let configs = if self.all {
            ALL_TOML_CONFIG_FILES.clone()
        } else {
            config::config_files_in_dir(&cwd)
        };
        if configs.is_empty() {
            bail!("No config file found in current directory");
        }
        let mut errors = Vec::new();
        for p in configs {
            if !p
                .file_name()
                .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;

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. cd into the directory that holds (or will hold) your mise.toml and rerun `mise fmt`
  2. Create the config first: `mise init` writes mise.toml, then `mise fmt`
  3. Format every TOML config mise knows about regardless of cwd: `mise fmt --all`
  4. Format a one-off config without creating a file: `mise fmt --stdin < in.toml > out.toml`

Example fix

# before
cd /tmp && mise fmt
# error: No config file found in current directory

# after
cd ~/work/myproj && mise fmt
# or: mise fmt --all
Defensive patterns

Strategy: validation

Validate before calling

#!/bin/bash
if ! ls mise.toml .mise.toml mise.local.toml .mise.local.toml 2>/dev/null | grep -q .; then
  echo "no mise TOML config in $PWD — skipping fmt" >&2
  exit 0   # or: mise fmt --all / mise init first
fi
mise fmt

Try / catch

mise fmt 2>/dev/null
rc=$?
[ $rc -eq 0 ] || mise fmt --all   # fall back to all known configs

Prevention

When it happens

Trigger: Running `mise fmt` in a directory tree that contains no mise TOML config: before `mise init`, in a fresh clone whose config lives in a parent/subdirectory, or in a project standardized on .tool-versions (which fmt does not process).

Common situations: Running fmt from $HOME or /tmp by accident; repo uses only .tool-versions; first use of mise in a new project before any config exists.

Related errors


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