{"record":{"id":"89dcc7c5390a918b","repo":"jdx/mise","slug":"no-config-file-found-in-current-directory","errorCode":null,"errorMessage":"No config file found in current directory","messagePattern":"No config file found in current directory","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/fmt.rs","lineNumber":49,"sourceCode":"            let mut toml = String::new();\n            io::stdin().read_to_string(&mut toml)?;\n\n            let toml = sort(toml)?;\n            let toml = format(toml)?;\n            let mut stdout = io::stdout();\n            write!(stdout, \"{toml}\")?;\n\n            return Ok(());\n        }\n\n        let cwd = dirs::CWD.clone().unwrap_or_default();\n        let configs = if self.all {\n            ALL_TOML_CONFIG_FILES.clone()\n        } else {\n            config::config_files_in_dir(&cwd)\n        };\n        if configs.is_empty() {\n            bail!(\"No config file found in current directory\");\n        }\n        let mut errors = Vec::new();\n        for p in configs {\n            if !p\n                .file_name()\n                .is_some_and(|f| f.to_string_lossy().ends_with(\"toml\"))\n            {\n                continue;\n            }\n            let source = file::read_to_string(&p)?;\n            let toml = source.clone();\n            let toml = sort(toml)?;\n            let toml = format(toml)?;\n            if self.check {\n                if source != toml {\n                    errors.push(p.display().to_string());\n                }\n                continue;","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/fmt.rs#L31-L67","documentation":"`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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["cd into the directory that holds (or will hold) your mise.toml and rerun `mise fmt`","Create the config first: `mise init` writes mise.toml, then `mise fmt`","Format every TOML config mise knows about regardless of cwd: `mise fmt --all`","Format a one-off config without creating a file: `mise fmt --stdin < in.toml > out.toml`"],"exampleFix":"# before\ncd /tmp && mise fmt\n# error: No config file found in current directory\n\n# after\ncd ~/work/myproj && mise fmt\n# or: mise fmt --all","handlingStrategy":"validation","validationCode":"#!/bin/bash\nif ! ls mise.toml .mise.toml mise.local.toml .mise.local.toml 2>/dev/null | grep -q .; then\n  echo \"no mise TOML config in $PWD — skipping fmt\" >&2\n  exit 0   # or: mise fmt --all / mise init first\nfi\nmise fmt","typeGuard":null,"tryCatchPattern":"mise fmt 2>/dev/null\nrc=$?\n[ $rc -eq 0 ] || mise fmt --all   # fall back to all known configs","preventionTips":["Run mise commands from the project root that holds mise.toml","In wrapper scripts, test for the config first (`test -f mise.toml`) instead of assuming","Use `mise fmt --all` in automation that may run outside the project directory","Initialize new projects with `mise init` so fmt always has a target"],"tags":["mise","fmt","config","toml","cli"],"backgroundTag":"missing-config-file","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}