{"record":{"id":"19777e65ff4bb15b","repo":"jdx/mise","slug":"postinstall-requires-a-toml-config-file","errorCode":null,"errorMessage":"--postinstall requires a TOML config file","messagePattern":"--postinstall requires a TOML config file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/use.rs","lineNumber":268,"sourceCode":"            .iter()\n            .map(|target| target.tool.clone())\n            .collect::<Vec<_>>();\n        env::TOOL_ARGS.write().unwrap().clone_from(&tool_args);\n        let mut config = Config::get().await?;\n        let scope = if self.global {\n            ConfigScope::GlobalOnly\n        } else {\n            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,","sourceCodeStart":250,"sourceCodeEnd":286,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/cli/use.rs#L250-L286","documentation":"`mise use --postinstall <cmd>` must write the postinstall hook into a mise.toml file; run() bails when any tool target carries a postinstall but the resolved config file source is not a MiseToml (e.g. it's .tool-versions or another format).","triggerScenarios":"`mise use --postinstall 'cmd' <tool>` while get_config_file().await resolves to a non-mise.toml source (ToolSource not MiseToml), checked in run().","commonSituations":"Project uses .tool-versions (asdf compat); user runs from a directory where the active config is not mise.toml; asdf_compat settings active.","solutions":["Create/switch to a mise.toml config file in the project.","Move tool declarations from .tool-versions into mise.toml.","Run the command from a directory whose resolved config is a mise.toml, or pass -f/--file pointing at a mise.toml."],"exampleFix":"// before\nmise use --postinstall 'npm rebuild' node  # only .tool-versions exists\n// after\nmv .tool-versions mise.toml   # or create mise.toml\nmise use --postinstall 'npm rebuild' node","handlingStrategy":"validation","validationCode":"[ -f mise.toml ] || { echo 'mise.toml required for --postinstall'; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the project uses mise.toml before using --postinstall.","Avoid mixing asdf .tool-versions workflows with mise-specific flags.","Verify the resolved config format in scripts before use."],"tags":["cli","postinstall","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-14T00:17:10.932Z"}