jdx/mise · error · eyre::Report

bootstrap resource '{}' is declared more than once

Error message

bootstrap resource '{}' is declared more than once

What it means

BootstrapPlan keys resources by ResourceId {kind, name} — e.g. `user:alice`, `group:devs`, `package:brew:ripgrep`, `directory:/etc/app`, `file:/etc/app.conf`, `service:foo`, `compose:bar`, `firewall:linux`. insert() bails when the same kind+name is inserted twice, i.e. when the same entity is declared in more than one place that feeds the plan (multiple merged config files, or the same path/package listed twice).

Source

Thrown at src/system/resources.rs:128

    }
}

#[derive(Serialize)]
pub struct BootstrapPlanOutput<'a> {
    pub resources: Vec<&'a ResourcePlan>,
    pub summary: PlanSummary,
}

/// A validated resource graph in declaration order.
#[derive(Default)]
pub struct BootstrapPlan {
    resources: IndexMap<ResourceId, ResourcePlan>,
}

impl BootstrapPlan {
    pub fn insert(&mut self, resource: ResourcePlan) -> Result<()> {
        if self.resources.contains_key(&resource.id) {
            bail!(
                "bootstrap resource '{}' is declared more than once",
                resource.id
            );
        }
        self.resources.insert(resource.id.clone(), resource);
        Ok(())
    }

    pub fn add_dependency(&mut self, resource: &ResourceId, dependency: ResourceId) -> Result<()> {
        let Some(resource) = self.resources.get_mut(resource) else {
            bail!("cannot add dependency to missing bootstrap resource '{resource}'");
        };
        if !resource.depends_on.contains(&dependency) {
            resource.depends_on.push(dependency);
        }
        Ok(())
    }

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. List the effective config files (`mise config ls`) and grep them for the name shown in the error's `kind:name` id
  2. Delete or merge the duplicate declaration in one layer — usually keep the project config and trim the local override
  3. For paths, make sure each entry appears under exactly one table and only once

Example fix

# before: mise.toml AND mise.local.toml both declare
[bootstrap.groups]
devs = {}

# after: declare `devs` once, in mise.toml only
Defensive patterns

Strategy: validation

Validate before calling

let mut seen = std::collections::HashSet::new();
for resource in resources {
    if !seen.insert(resource.id.clone()) {
        return Err(eyre::eyre!("duplicate {}", resource.id)); // or merge/dedupe
    }
    plan.insert(resource)?;
}

Prevention

When it happens

Trigger: The same user or group declared under `[bootstrap.users]` / `[bootstrap.groups]` in two config files that are both active (project mise.toml + mise.local.toml + includes); the same path listed twice under `[bootstrap.files]` or `[bootstrap.directories]`; the same package contributed twice for one manager.

Common situations: Layered project and local configs both declaring an account; config `additional`/include files duplicating a section; copy-pasting a section from global config into project config while both apply.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/dd3673a71823e8dd. Report an issue: GitHub.