jdx/mise · error

expected task tool selector validation to fail

Error message

expected task tool selector validation to fail

What it means

Panic in the task tool selector validation unit test: toml::from_str::<TaskTools> on an intentionally invalid [tools] definition succeeded instead of failing with the expected message (e.g. both version and prefix set, none of version/path/prefix/ref set, wrong prefix type). It fires when validation in the TaskTools deserializer is missing or its error text changed.

Source

Thrown at src/task/mod.rs:5926

            Some(&vec![toml::Value::Integer(1), toml::Value::Boolean(true)])
        );

        for (invalid, expected) in [
            (
                "[tools]\nnode = { version = \"20\", prefix = \"20\" }\n",
                "tool definition cannot specify both `version` and `prefix`",
            ),
            (
                "[tools]\nnode = { os = \"linux\" }\n",
                "tool definition must include exactly one of `version`, `path`, `prefix`, or `ref`",
            ),
            (
                "[tools]\nnode = { prefix = 20 }\n",
                "tool selector `prefix` must be a string",
            ),
        ] {
            let err = match toml::from_str::<TaskTools>(invalid) {
                Ok(_) => panic!("expected task tool selector validation to fail"),
                Err(err) => err,
            };
            assert!(err.to_string().contains(expected), "{err}");
        }
    }

    #[tokio::test]
    async fn test_to_tool_arg_preserves_structured_core_options() {
        use indexmap::IndexMap;

        use crate::config::Config;

        use super::{TaskToolValue, TaskToolValueMap};

        let _config = Config::get().await.unwrap();
        let tool = TaskToolValue::Map(TaskToolValueMap {
            version: "1.0.0".to_string(),
            opts: IndexMap::from([

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Restore/verify validation rejecting version+prefix together and requiring exactly one of version/path/prefix/ref
  2. Ensure error messages match the expected strings in the test table exactly
  3. Rerun the validation test loop over all invalid cases
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/task/mod.rs:5926 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/c1b4ee6424593e01. Report an issue: GitHub.