{"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":3579,"sourceCode":"                .map(|(_, task)| task)\n                .unique()\n                .collect();\n            if !matched.is_empty() {\n                return Ok(matched);\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":3561,"sourceCodeEnd":3597,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/mod.rs#L3561-L3597","documentation":"This is an internal-consistency error: `:task` patterns are supposed to be expanded (to their concrete '//dir:task' form) before get_matching runs. Reaching the ':'' branch inside get_matching means an earlier expansion step was skipped, so mise bails rather than guessing the directory.","triggerScenarios":"A code path (or plugin/extension) calls the pattern matcher directly with a raw ':build' pattern instead of first expanding it via the task-context expansion step; normally unreachable from the CLI.","commonSituations":"Rarely hit by users; appears when internal refactors skip expansion or when scripting against mise internals. Report it as a bug if seen from a normal `mise run` invocation.","solutions":["Upgrade mise — this usually indicates an internal bug that may already be fixed","Work around by writing the pattern as '//<path>:task' instead of ':task'","File a bug report with the exact command that produced it"],"exampleFix":"// before\nmise run :build\n\n// after\nmise run //current/dir:build","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await run(['mise', 'run', task]);\n} catch (e) {\n  if (e.message.includes(\"':task' pattern should be expanded\")) {\n    console.error('mise internal bug; upgrade mise or use //path:task form');\n  }\n  throw e;\n}","preventionTips":["Keep mise up to date; this error indicates an internal invariant break","Always let mise expand ':task' patterns — don't call internal matcher APIs directly","File a bug with the exact repro command if it appears during normal usage"],"tags":["tasks","monorepo","internal"],"backgroundTag":"internal-invariant-violation","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}