{"record":{"id":"d963f2c3ca968a23","repo":"jdx/mise","slug":"tool-option-requires-a-toml-config-file","errorCode":null,"errorMessage":"--tool-option requires a TOML config file","messagePattern":"--tool-option requires a TOML config file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/use.rs","lineNumber":276,"sourceCode":"            ConfigScope::All\n        };\n        let mut ts = ToolsetBuilder::new()\n            .with_scope(scope)\n            .build(&config)\n            .await?;\n        let mut cf = self.get_config_file().await?;\n        if self.tools.iter().any(|target| target.postinstall.is_some())\n            && !matches!(cf.source(), ToolSource::MiseToml(_))\n        {\n            bail!(\"--postinstall requires a TOML config file\");\n        }\n        if self\n            .tools\n            .iter()\n            .any(|target| !target.tool_option.is_empty())\n            && !matches!(cf.source(), ToolSource::MiseToml(_))\n        {\n            bail!(\"--tool-option requires a TOML config file\");\n        }\n        let pin = self.pin || !self.fuzzy && (Settings::get().pin || Settings::get().asdf_compat);\n        let mut resolve_options = ResolveOptions {\n            latest_versions: false,\n            use_locked_version: true,\n            resolve_rolling_channels: false,\n            prefer_exact_version: pin,\n            before_date: self.get_before_date()?,\n            before_date_from_default: false,\n            filter_installed_versions_by_release_date: false,\n            offline: false,\n            refresh_remote_versions: false,\n            inactive: false,\n        };\n        let versions: Vec<_> = self\n            .tools\n            .iter()\n            .map(|target| {","sourceCodeStart":258,"sourceCodeEnd":294,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/use.rs#L258-L294","documentation":"Config-file-type validation in `mise use` run(): --tool-option (like --postinstall) was supplied while the target config file is not a mise.toml-format TOML file (e.g. .tool-versions), which cannot represent tool option tables. The bail stops the write before corrupting an unsupported format.","triggerScenarios":"`mise use <tool> --tool-option k=v` where get_config_file().await resolves to a non-mise.toml source (e.g. .tool-versions), checked in run().","commonSituations":"asdf-compat projects using .tool-versions; running in a directory without mise.toml; CI scripts assuming TOML output.","solutions":["Ensure a mise.toml exists in the project before running `mise use --tool-option`.","Migrate .tool-versions entries into mise.toml.","Pass -f/--file targeting a mise.toml explicitly."],"exampleFix":"// before\nmise use node --tool-option version=22   # config resolves to .tool-versions\n// after\ntouch mise.toml\nmise use node --tool-option version=22","handlingStrategy":"validation","validationCode":"[ -f mise.toml ] || { echo 'mise.toml required for --tool-option'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Create mise.toml before running mise use with options.","Migrate .tool-versions to mise.toml when adopting mise-only features.","In CI, assert the config file format before tool-option usage."],"tags":["cli","tool-options","config-format"],"backgroundTag":"unsupported-config-value","analyzedSha":"afd2eddd3a50c16190efc1c7e94404b48f72af57","analyzedAt":"2026-09-09T01:38:25.179Z","contentChangedAt":"2026-09-09T01:38:25.179Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}