jdx/mise · error

workspace project has root that escapes the workspace root

Error message

workspace project {id:?} has root {root:?} that escapes the workspace root

What it means

While normalizing a workspace project's relative root, a ParentDir ("..") component with no remaining parent means the path climbs above the workspace root. mise rejects this to keep every project inside the workspace directory tree.

Solutions

  1. Rewrite the root as a path that stays inside the workspace (no leading "..")
  2. Move the referenced project directory into the workspace
  3. If a shared project must live outside, restructure the workspace so the workspace root encloses it

Example fix

# before
[workspace.project.shared]
root = "../shared"
# after
[workspace.project.shared]
root = "shared"
Defensive patterns

Strategy: validation

Validate before calling

fn stays_inside_workspace(root: &std::path::Path) -> bool {
    let mut depth = 0usize;
    for c in root.components() {
        match c {
            std::path::Component::ParentDir => {
                if depth == 0 { return false; }
                depth -= 1;
            }
            std::path::Component::Normal(_) => depth += 1,
            _ => {}
        }
    }
    true
}

Type guard

let inside_ws = |p: &std::path::Path| stays_inside_workspace(p);

Try / catch

if let Err(e) = normalize_project_root(&id, &root) {
    if e.to_string().contains("escapes the workspace root") {
        eprintln!("root must not climb above the workspace root");
    }
}

Prevention

When it happens

Trigger: A [workspace.project] root such as "../shared" or "a/../../b" where popping parent components empties the normalized path for project {id}.

Common situations: Referencing a sibling directory outside the workspace via ".."; refactoring roots after moving a project deeper without adjusting relative paths.

Understand the failure class

Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.

Related errors


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

Appendix: source

Thrown at src/task/workspace.rs:1202

        })
        .collect()
}

fn normalize_project_root(id: &ProjectId, root: &Path) -> Result<PathBuf> {
    if root.is_absolute() {
        bail!(
            "workspace project {id:?} has absolute root {root:?}; roots must be workspace-relative"
        );
    }

    let mut normalized = PathBuf::new();
    for component in root.components() {
        match component {
            Component::CurDir => {}
            Component::Normal(component) => normalized.push(component),
            Component::ParentDir => {
                if !normalized.pop() {
                    bail!(
                        "workspace project {id:?} has root {root:?} that escapes the workspace root"
                    );
                }
            }
            Component::RootDir | Component::Prefix(_) => {
                bail!(
                    "workspace project {id:?} has absolute root {root:?}; roots must be workspace-relative"
                );
            }
        }
    }
    if normalized.as_os_str().is_empty() {
        normalized.push(".");
    }
    Ok(normalized)
}

fn normalize_workspace_path(path: &Path) -> Result<PathBuf> {

View on GitHub (pinned to 533346cc37)