{"record":{"id":"4c38f897535f7ced","repo":"jdx/mise","slug":"task-pattern-should-be-expanded-before-matching","errorCode":null,"errorMessage":"':task' pattern should be expanded before matching","messagePattern":"':task' pattern should be expanded before matching","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/mod.rs","lineNumber":3489,"sourceCode":"                .map(|(_, task)| task)\n                .unique()\n                .collect();\n            if !ext_stripped.is_empty() {\n                return Ok(ext_stripped);\n            }\n            if self.keys().any(|k| k.starts_with(\"//\")) {\n                return self.get_matching(&format!(\"//{pat}\"));\n            }\n            return Ok(vec![]);\n        }\n\n        // === Parse monorepo pattern ===\n        let normalized_pat = if pat.starts_with(\"//\") {\n            pat.to_string()\n        } else if pat.starts_with(':') {\n            // Special case: :task should have been expanded before calling get_matching\n            // If we reach here, it means the expansion didn't happen properly\n            bail!(\"':task' pattern should be expanded before matching\")\n        } else {\n            pat.to_string()\n        };\n\n        // Split pattern into path and task parts\n        // Pattern format: //path/...:task* or //path:task*\n        let parts: Vec<&str> = normalized_pat.splitn(2, ':').collect();\n        if pat.starts_with(\"//\") && parts.len() == 1 {\n            bail!(\n                \"missing task name in monorepo path '{}', use '{}:<task>' or '{}:*' to run all tasks in that path\",\n                pat,\n                pat,\n                pat\n            );\n        }\n        let (path_pattern, task_pattern) = match parts.as_slice() {\n            [path, task] => (*path, *task),\n            [path] => (*path, \"*\"),","sourceCodeStart":3471,"sourceCodeEnd":3507,"githubUrl":"https://github.com/jdx/mise/blob/afd2eddd3a50c16190efc1c7e94404b48f72af57/src/task/mod.rs#L3471-L3507","documentation":"The `:task` monorepo pattern (current-directory task) is expected to be expanded into a concrete task reference before monorepo pattern matching runs. Reaching the matching function with an unexpanded `:`-prefixed pattern indicates an internal expansion step was skipped — mise treats it as an invariant violation rather than matching incorrectly.","triggerScenarios":"Calling the internal monorepo pattern matcher `get_matching` with a pattern like `:build` that should have been expanded to `//<current-dir>:build` beforehand; can surface via CLI paths that bypass normal expansion.","commonSituations":"Mostly an internal/edge-case error; users may see it if tooling (scripts, plugins) invokes task matching APIs with raw `:task` selectors, or from undiscovered code paths after a mise version change.","solutions":["Update mise to the latest version — this usually indicates a bug in the expansion step","If calling internals, expand `:task` to `//<abs-or-project-relative-path>:task` before invoking get_matching","Report the issue to mise with the command that produced it (file a bug with reproduction steps)"],"exampleFix":"// before (caller code)\nget_matching(\":build\", ...)\n\n// after (caller code)\nlet expanded = format!(\"//{}:build\", project_relative_dir);\nget_matching(&expanded, ...)","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"# shell\nif mise run \":build\" 2>&1 | grep -q \"should be expanded before matching\"; then\n  mise upgrade   # likely a mise bug; retry on latest\nfi","preventionTips":["Keep mise up to date; this indicates an internal expansion bug, not user error","Avoid passing raw `:task` selectors to internal/API surfaces from scripts","Report reproducible occurrences upstream with MISE_DEBUG=1 output"],"tags":["tasks","monorepo","internal","pattern-matching"],"backgroundTag":"internal-invariant-violation","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"}