{"record":{"id":"930398c210feb72c","repo":"jdx/mise","slug":"cannot-use-task-syntax-without-a-monorepo-root","errorCode":null,"errorMessage":"Cannot use :task syntax without a monorepo root","messagePattern":"Cannot use :task syntax without a monorepo root","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/task/task_load_context.rs","lineNumber":210,"sourceCode":"    if !is_colon_pattern && task.contains('/') && task.contains(':') {\n        bail!(\n            \"relative path syntax '{}' is not supported, use '//{}' or ':task' for current directory\",\n            task,\n            task\n        );\n    }\n\n    // Get the monorepo root config file.\n    let monorepo_root = config\n        .config_files\n        .values()\n        .find(|cf| cf.monorepo_root() == Some(true))\n        .and_then(|cf| cf.project_root());\n\n    // If not in monorepo context, only expand if it's a colon pattern (error), otherwise return as-is\n    if monorepo_root.is_none() {\n        if is_colon_pattern {\n            bail!(\"Cannot use :task syntax without a monorepo root\");\n        }\n        return Ok(task.to_string());\n    }\n\n    // We're in a monorepo context\n    let monorepo_root = monorepo_root.unwrap();\n\n    // Task names are keyed to project roots: the directories of configs in\n    // scope plus declared [monorepo].config_roots, which may hold only file\n    // tasks and no config. Scope to the nearest such root above cwd, not cwd\n    // itself; the monorepo root bounds the walk and counts as a root.\n    if let Some(cwd) = &*crate::dirs::CWD {\n        let scope_dir: &Path = if cwd.starts_with(&monorepo_root) {\n            let roots: Vec<PathBuf> = config\n                .config_files\n                .values()\n                .filter_map(|cf| cf.project_root())\n                .chain(config.monorepo_config_root_dirs(None).unwrap_or_default())","sourceCodeStart":192,"sourceCodeEnd":228,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/task/task_load_context.rs#L192-L228","documentation":"The ':task' syntax explicitly scopes a task to the current monorepo package, so it is only meaningful when a config file establishes a monorepo root. When expand_colon_task_syntax finds no config with monorepo_root() == Some(true), any colon-prefixed reference is rejected because there is no monorepo context to resolve it against.","triggerScenarios":"Running `mise run :task` (or any reference starting with ':') in a project where no loaded config file is marked as a monorepo root (no root mise.toml declaring the workspace root).","commonSituations":"Using monorepo task syntax in a standalone (non-monorepo) project; running from a subdirectory whose root config is missing or untrusted; forgetting to add a root mise.toml that defines the monorepo root.","solutions":["Add/verify a root mise.toml at the repo root that establishes the monorepo root","Use the plain task name instead: `mise run task`","If not in a monorepo, cd to the package directory and run the task without ':' prefix","Check config is loaded/trusted: `mise trust` and inspect `mise config ls`"],"exampleFix":"// before\nmise run :build   # in a project with no monorepo root\n// after\nmise run build\n# or add a root mise.toml marking the monorepo root","handlingStrategy":"validation","validationCode":"mise config ls | grep -q . || echo 'no config loaded'; test -f mise.toml || echo 'no root mise.toml (monorepo root likely missing)'","typeGuard":null,"tryCatchPattern":"if ! mise run \"$TASK\" 2>/dev/null; then mise run \"${TASK#:}\"; fi","preventionTips":["Ensure a root mise.toml exists to declare the monorepo root","Use ':task' syntax only in actual monorepos","Trust configs: mise trust","Fallback to bare task names in non-monorepo projects"],"tags":["tasks","monorepo","config"],"backgroundTag":"invalid-config-value","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"}