jdx/mise · error

expected mapped task tool for {tool}

Error message

expected mapped task tool for {tool}

What it means

Let-else panic in a task TOML deserialization unit test: parsed.tools[tool] was not a TaskToolValue::Map for one of node/go/python/shellcheck, meaning the TaskTools deserializer did not map an inline table (with version, prefix, ref, path, or backend_options) into the Map variant. Fires when the custom TOML parsing for [tools] entries regresses.

Source

Thrown at src/task/mod.rs:5898

        let parsed: TaskTools = toml::from_str(
            r#"
            [tools]
            node = { version = "20", backend_options = { nested = [1, true] } }
            go = { prefix = "1.22" }
            python = { ref = "main" }
            shellcheck = { path = "/opt/shellcheck" }
            "#,
        )
        .unwrap();

        for (tool, expected) in [
            ("node", "20"),
            ("go", "prefix:1.22"),
            ("python", "ref:main"),
            ("shellcheck", "path:/opt/shellcheck"),
        ] {
            let TaskToolValue::Map(value) = &parsed.tools[tool] else {
                panic!("expected mapped task tool for {tool}");
            };
            assert_eq!(value.version, expected);
        }

        let TaskToolValue::Map(node) = &parsed.tools["node"] else {
            panic!("expected mapped node task tool");
        };
        assert_eq!(
            node.opts["backend_options"]["nested"].as_array(),
            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`",
            ),
            (

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Fix the TaskTools Deserialize impl so inline tables become TaskToolValue::Map with the correct version string
  2. Check the prefix:/ref:/path: composition logic matches the expected strings in the test table
  3. Rerun the task TOML parsing tests
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/task/mod.rs:5898 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/88deddd2c17cb766. Report an issue: GitHub.