jdx/mise · error

invalid or repeated enrollment path {}

Error message

invalid or repeated enrollment path {}

What it means

Thrown by `Manifest::validate` when an enrollment path fails `is_safe_branch_path`, is not under `home/` or `config`/`config/`, or duplicates a path already enrolled. Each enrollment must map to a unique, portable branch path in the dotfile repository.

Source

Thrown at src/system/history/manifest.rs:368

                });
            }
        }
        repo.compose(tree, &overlays)
    }

    pub(crate) fn validate(&self) -> Result<()> {
        if self.format != 1 {
            bail!("unsupported dotfile repository format {}", self.format);
        }
        let mut paths = std::collections::BTreeSet::new();
        for entry in &self.enrollment {
            if !super::sync::layout::is_safe_branch_path(&entry.path)
                || !(entry.path.starts_with("home/")
                    || entry.path == "config"
                    || entry.path.starts_with("config/"))
                || !paths.insert(&entry.path)
            {
                bail!("invalid or repeated enrollment path {}", entry.path);
            }
            let mut variants = std::collections::BTreeSet::new();
            super::select::validate(&entry.variants)?;
            for variant in &entry.variants {
                let name = variant.name();
                if name.contains('@')
                    || !super::sync::layout::is_safe_branch_path(&name)
                    || !variants.insert(name)
                {
                    bail!("invalid or repeated variant for {}", entry.path);
                }
            }
        }
        for (path, bits) in &self.permissions {
            if *bits > 0o777
                || !super::sync::layout::is_safe_branch_path(path)
                || !self.owns_stream(path)
            {

View on GitHub (pinned to afd2eddd3a)

Solutions

  1. Remove duplicate enrollment entries, keeping one entry per path.
  2. Rewrite the path to a safe branch form relative to `home/` or `config/`.
  3. Move the file under an allowed root or stop enrolling it through this mechanism.
  4. Sanitize the path (no `..`, no invalid branch characters) before adding to the manifest.

Example fix

// before
[[enrollment]]
path = "/etc/nginx/nginx.conf"
// after
[[enrollment]]
path = "config/nginx/nginx.conf"
Defensive patterns

Strategy: validation

Validate before calling

// check path safety + uniqueness before enrolling:
// case "$p" in home/*|config|config/*) ;; *) echo "bad path $p";; esac
// grep -c "path = \"$p\"" manifest | grep -q '^1$' || echo "duplicate"

Try / catch

// on "invalid or repeated enrollment path {path}": remove duplicates
// or correct the path in the manifest, then retry

Prevention

When it happens

Trigger: Enrolling a path containing traversal (`..`), absolute paths, invalid branch-path characters, paths outside the home/config roots, or enrolling the same file twice (insert into the BTreeSet fails).

Common situations: Hand-editing the manifest and introducing a duplicate entry or Windows-style path; enrolling a file outside the allowed roots; path entries with spaces or special characters unsafe as git branch names.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09). Data as JSON: /api/errors/75f15e459f51c9eb. Report an issue: GitHub.