{"record":{"id":"7f1f6d1ec7e34e7c","repo":"jdx/mise","slug":"following-config-files-are-not-properly-formatted","errorCode":null,"errorMessage":"Following config files are not properly formatted:\n{}","messagePattern":"Following config files are not properly formatted:\n(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/fmt.rs","lineNumber":88,"sourceCode":"                .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;\n            }\n            file::write(&p, &toml)?;\n        }\n\n        if !errors.is_empty() {\n            bail!(\n                \"Following config files are not properly formatted:\\n{}\",\n                errors.join(\"\\n\")\n            );\n        }\n\n        Ok(())\n    }\n}\n\n/// Put the document's top-level keys and its unordered lists into a canonical\n/// order. Whitespace and layout are left to [`format`].\nfn sort(toml: String) -> Result<String> {\n    let mut doc: DocumentMut = toml.parse()?;\n    let order = |k: String| match k.as_str() {\n        \"min_version\" => 0,\n        \"env_file\" => 1,\n        \"env_path\" => 2,\n        \"_\" => 3,","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/fmt.rs#L70-L106","documentation":"`mise fmt` collected parse/format errors for one or more config files and bails listing them. Files that could be parsed were rewritten; files whose TOML failed to parse or format are reported so the user can fix them manually.","triggerScenarios":"While iterating configs, parsing or formatting a TOML file produced an error pushed into `errors`; after processing all files errors is non-empty.","commonSituations":"Hand-edited mise.toml with syntax errors (unclosed strings, bad tables), TOML features the formatter cannot round-trip, or an unreadable/locked file.","solutions":["Fix the syntax error in each listed file (the message lists them line-by-line)","Validate TOML with a linter/editor plugin before saving","Restore the file from version control if the edit broke it"],"exampleFix":"// before\n[env]\nFOO = \"unclosed\n// after\n[env]\nFOO = \"closed\"","handlingStrategy":"validation","validationCode":"python3 -c \"import tomllib;tomllib.load(open('mise.toml','rb'))\" && echo ok","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run a TOML linter in the editor","Commit config changes only after `mise fmt` passes"],"tags":["cli","fmt","toml"],"backgroundTag":"schema-validation-failed","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}