jdx/mise · error

expected mapped node task tool

Error message

expected mapped node task tool

What it means

Second let-else panic in the same task TOML test, specifically asserting the node entry: parsed.tools["node"] was not TaskToolValue::Map after the per-tool loop passed. It isolates the node entry's backend_options.nested handling — the map variant or its fields were lost during deserialization of node = { version = "20", backend_options = { nested = [1, true] } }.

Source

Thrown at src/task/mod.rs:5904

            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`",
            ),
            (
                "[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",

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Ensure TaskToolValue::Map preserves backend_options (including nested mixed-type arrays) for the node entry
  2. Compare the deserialized Map fields against the raw TOML to find the dropped key
  3. Rerun the test after fixing the deserializer
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at src/task/mod.rs:5904 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/802911d140564d80. Report an issue: GitHub.