{"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/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/task/task_load_context.rs#L192-L228","documentation":"When expanding a colon pattern (`:task`), mise requires a config file marked as the monorepo root (config_files value with monorepo_root() == Some(true) and a project root). If none of the configs in scope declares itself a monorepo root, the ':' shorthand has nothing to be relative to, so mise bails. Bare task names pass through untouched in this situation — only colon patterns error.","triggerScenarios":"Running `mise :build` in a repo where no mise.toml sets the monorepo marker (e.g. no `[monorepo]` section / monorepo = true in the root config), or where the root config is untrusted so it is not in config_files at all.","commonSituations":"Copy-pasting monorepo-style invocations into a single-package repo; the monorepo root config was renamed or removed; using a non-mise monorepo (pnpm-workspace, cargo workspace) without adding mise's marker.","solutions":["Mark the repo root config as monorepo root (add the [monorepo] settings / monorepo marker in the root mise.toml).","Use the plain task name instead: `mise build`.","Use the absolute syntax `mise //path/to/pkg:build` only after a monorepo root is declared — otherwise just run the task by bare name.","Run `mise trust` if the root config exists but is untrusted so its monorepo flag is not loaded."],"exampleFix":"# before\n# mise.toml (repo root) lacks monorepo marker\n$ mise :build\nerror: Cannot use :task syntax without a monorepo root\n\n# after\n# mise.toml\n[monorepo]\nconfig_roots = [\"packages/*\"]\n$ mise :build","handlingStrategy":"validation","validationCode":"# check a monorepo marker exists before using :task\nmise config ls 2>/dev/null | grep -q mise.toml || { echo 'no mise config in scope' >&2; exit 1; }\nmise :build","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare the monorepo root ([monorepo] in root mise.toml) before adopting :task syntax.","Trust the root config so its monorepo flag loads.","In single-package repos, use bare task names."],"tags":["monorepo","task-syntax","config","mise"],"backgroundTag":"monorepo-scope-resolution-failed","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}