{"record":{"id":"abf220daf6714a9c","repo":"jdx/mise","slug":"cannot-use-task-syntax-outside-of-monorepo-root-d","errorCode":null,"errorMessage":"Cannot use :task syntax outside of monorepo root directory","messagePattern":"Cannot use :task syntax outside of monorepo root directory","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_load_context.rs","lineNumber":247,"sourceCode":"                .collect();\n            cwd.ancestors()\n                .find(|a| *a == monorepo_root || roots.iter().any(|r| r == a))\n                .unwrap_or(cwd)\n        } else {\n            cwd\n        };\n        if let Some(scope) = monorepo_scope(&monorepo_root, scope_dir) {\n            // For bare task names, only expand if we're actually in the monorepo\n            // For colon patterns, always expand (and error if outside monorepo)\n\n            if is_colon_pattern {\n                Ok(format!(\"{scope}{task}\"))\n            } else {\n                Ok(format!(\"{scope}:{task}\"))\n            }\n        } else {\n            if is_colon_pattern {\n                bail!(\"Cannot use :task syntax outside of monorepo root directory\");\n            }\n            // Bare name outside monorepo - return as-is for global matching\n            Ok(task.to_string())\n        }\n    } else {\n        if is_colon_pattern {\n            bail!(\"Cannot use :task syntax without a current working directory\");\n        }\n        Ok(task.to_string())\n    }\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_monorepo_scope() {","sourceCodeStart":229,"sourceCodeEnd":265,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/task/task_load_context.rs#L229-L265","documentation":"With a monorepo root configured, a colon pattern must resolve to a scope: mise computes the nearest project root (config dir or declared [monorepo].config_roots) at or above cwd, bounded by the monorepo root. If cwd is not under any such scope — i.e. you are outside the monorepo directory tree — the ':' pattern cannot be expanded and mise errors. Bare names silently pass through for global matching.","triggerScenarios":"Running `mise :build` with cwd outside the monorepo root directory (e.g. the monorepo root is /repo but cwd is /other, or cwd is in a directory excluded from config_roots); invoking from a scratch/tmp directory while a monorepo-root config is still in scope (e.g. via MISE_CONFIG_FILE or global config).","commonSituations":"cd-ing elsewhere then running mise with the monorepo config still attached via env vars; monorepo root detected from a config in a parent of HOME-like paths; scripts that compute cwd incorrectly.","solutions":["cd into a directory under the monorepo root (ideally inside the target package) and rerun.","Use the absolute form `mise //pkg:build` which does not depend on cwd scoping.","Use the bare task name `mise build` for global matching.","If the monorepo root was mis-detected, check MISE_CONFIG_FILE / MISE_GLOBAL_CONFIG_FILE env overrides."],"exampleFix":"# before (cwd=/tmp)\n$ mise :build\nerror: Cannot use :task syntax outside of monorepo root directory\n\n# after\n$ cd /repo/packages/web && mise :build\n# or\n$ mise //packages/web:build","handlingStrategy":"validation","validationCode":"# ensure cwd is inside the repo before :task\npwd | grep -q \"^$REPO_ROOT\" || { echo 'run from inside the monorepo' >&2; exit 1; }\nmise :build","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run tasks from inside the monorepo; use //pkg:task from outside.","Beware MISE_CONFIG_FILE pulling a monorepo config into unrelated cwd."],"tags":["monorepo","task-syntax","working-directory","mise"],"backgroundTag":"monorepo-scope-resolution-failed","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}