jdx/mise · error

relative path syntax

Error message

relative path syntax '{}' is not supported, use '//{}' or ':task' for current directory

What it means

expand_colon_task_syntax validates task reference syntax for monorepos. A string containing both '/' and ':' that does not start with ':' or '//' is ambiguous legacy relative-path syntax that mise no longer supports, so it bails and tells you the two accepted forms: '//path:task' or ':task' for the current directory.

Solutions

  1. Prefix the path with '//': `mise run //sub/dir:task`
  2. Use ':task' syntax from within the subdirectory: cd sub/dir && mise run :task
  3. Remove the slash if you meant a bare task name: `mise run task`
  4. Update scripts/docs that still use the old `dir:task` relative syntax

Example fix

// before
mise run sub/dir:build
// after
mise run //sub/dir:build
Defensive patterns

Strategy: validation

Validate before calling

[[ "$TASK" == */*:* ]] && [[ "$TASK" != //* && "$TASK" != :* ]] && echo "use '//path:task' or ':task'" || true

Try / catch

if mise run "$TASK" 2>&1 | grep -q 'relative path syntax'; then TASK="//$TASK"; mise run "$TASK"; fi

Prevention

When it happens

Trigger: Calling mise run/task with a task reference like `sub/dir:task` or `./dir:task` (a path with a slash AND a colon that starts with neither '//' nor ':').

Common situations: Migrating from older mise syntax where `dir:task` meant a relative monorepo path; copy-pasting task refs from docs of other tools; typos missing one '/' in '//dir:task'.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/c1e192e076af015e. Report an issue: GitHub.

Appendix: source

Thrown at src/task/task_load_context.rs:193

///
/// # Returns
/// * `Ok(String)` - The expanded task pattern (e.g., "//project:build")
/// * `Err` - If monorepo is not configured or current directory is outside monorepo root
pub(crate) fn expand_colon_task_syntax(
    task: &str,
    config: &crate::config::Config,
) -> eyre::Result<String> {
    // Skip expansion for absolute monorepo paths or explicit global tasks
    if task.starts_with("//") || task.starts_with("::") || is_workspace_project_task(task) {
        return Ok(task.to_string());
    }

    // Check if this is a colon pattern or a bare name
    let is_colon_pattern = task.starts_with(':');

    // Reject patterns that look like monorepo paths with wrong syntax (have / and : but don't start with // or :)
    if !is_colon_pattern && task.contains('/') && task.contains(':') {
        bail!(
            "relative path syntax '{}' is not supported, use '//{}' or ':task' for current directory",
            task,
            task
        );
    }

    // Get the monorepo root config file.
    let monorepo_root = config
        .config_files
        .values()
        .find(|cf| cf.monorepo_root() == Some(true))
        .and_then(|cf| cf.project_root());

    // If not in monorepo context, only expand if it's a colon pattern (error), otherwise return as-is
    if monorepo_root.is_none() {
        if is_colon_pattern {
            bail!("Cannot use :task syntax without a monorepo root");
        }

View on GitHub (pinned to 533346cc37)