jdx/mise · error

tracking requires a portable path under home or the mise…

Error message

tracking requires a portable path under home or the mise configuration directory

What it means

Tracked paths must live under the user's home directory or the mise configuration directory so history can store portable relative paths. ensure_portable_ancestors bails when the requested path is relative to neither base, because it cannot compute a stable relative representation.

Solutions

  1. Move the file into your home directory or the mise config directory and track it there.
  2. Use a symlink inside home pointing to the real file and track the link explicitly (not through it).
  3. If the file genuinely must live outside home, manage it outside mise history tracking.

Example fix

// before
mise history track /etc/myapp/config.toml
// after
cp /etc/myapp/config.toml ~/.config/myapp/config.toml
mise history track ~/.config/myapp/config.toml
Defensive patterns

Strategy: validation

Validate before calling

fn is_portable(p: &Path, home: &Path, config: &Path) -> bool {
  p.starts_with(home) || p.starts_with(config)
}

Try / catch

match add_requests(reqs) {
  Err(e) if e.to_string().contains("portable path") => move_under_home_and_retrack(),
  other => other?,
}

Prevention

When it happens

Trigger: Calling add_requests (which runs ensure_portable_ancestors) with an absolute path that is not under `home` or `global_config_dir()`, so `relative(base)` returns None for every candidate base.

Common situations: Tracking a file in /etc, /opt, another user's home, or a directory outside $HOME on purpose; CI paths in temporary directories; typos producing paths outside home.

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/ad4ef14999087411. Report an issue: GitHub.

Appendix: source

Thrown at src/system/history/tracked.rs:827

            let actual = components.next()?;
            if actual != expected
                && !(cfg!(windows)
                    && actual
                        .as_os_str()
                        .to_string_lossy()
                        .eq_ignore_ascii_case(&expected.as_os_str().to_string_lossy()))
            {
                return None;
            }
        }
        Some(components.collect::<PathBuf>())
    };
    let Some((base, rest)) = bases
        .iter()
        .filter_map(|base| relative(base).map(|rest| (base, rest)))
        .max_by_key(|(base, _)| base.components().count())
    else {
        eyre::bail!(
            "tracking requires a portable path under home or the mise configuration directory"
        );
    };
    let mut ancestor = base.clone();
    for component in rest
        .components()
        .take(rest.components().count().saturating_sub(1))
    {
        ancestor.push(component);
        if file::is_symlink_or_junction(&ancestor) {
            eyre::bail!(
                "cannot track {} through symlinked parent {}; explicitly track the link itself and its real target instead",
                display_path(path),
                display_path(&ancestor)
            );
        }
    }
    Ok(())

View on GitHub (pinned to 533346cc37)