jdx/mise · error

remote target '{destination}' was selected more than once

Error message

remote target '{destination}' was selected more than once

What it means

While assembling the fan-out set, BootstrapRemote::run inserts each --host entry into the selected-hosts map keyed by host name; if the key was already present - chosen from inventory by name, --tag, or --all, or an earlier duplicate --host - it bails (src/cli/bootstrap.rs:2332) rather than run the same machine twice with merged overrides.

Source

Thrown at src/cli/bootstrap.rs:2332

        }
    }
}

impl BootstrapRemote {
    async fn run(self) -> Result<()> {
        if self.connect_timeout == 0 {
            bail!("--connect-timeout must be greater than zero");
        }
        let config = Config::get().await?;
        let config_excludes = system::remote::excludes_from_config(&config);
        let inventory = system::remote::hosts_from_config(&config, &config_excludes)?;
        let mut selected = select_remote_inventory(&inventory, &self.targets, self.all, &self.tag)?;
        let ad_hoc_source = self.source.clone().unwrap_or(std::env::current_dir()?);
        for destination in &self.host {
            let host =
                system::remote::ad_hoc_host(destination, ad_hoc_source.clone(), &config_excludes)?;
            if selected.insert(host.name.clone(), host).is_some() {
                bail!("remote target '{destination}' was selected more than once");
            }
        }
        if selected.is_empty() {
            if inventory.is_empty() {
                bail!(
                    "no remote targets configured; pass --host [user@]host or add [bootstrap.remote.hosts]"
                );
            }
            bail!(
                "select a remote target by name, --tag, or --all (configured: {})",
                inventory.keys().cloned().collect::<Vec<_>>().join(", ")
            );
        }

        let overrides = system::remote::RemoteOverrides {
            source: self.source,
            port: self.port,
            identity_file: self.identity_file,

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Drop the redundant selection: remove the --host entry that overlaps the name/tag/--all pick
  2. Deduplicate the host list in the calling script (sort -u) before invoking mise
  3. Rename the ad-hoc host or the inventory entry if the collision is accidental
  4. Review [bootstrap.remote.hosts] names to see which one collides

Example fix

# before
mise bootstrap remote --all --host deploy@web1   # web1 already in inventory
# Error: remote target 'web1' was selected more than once

# after
mise bootstrap remote --all   # or just: mise bootstrap remote --host deploy@web1
Defensive patterns

Strategy: validation

Validate before calling

# bash: dedupe hosts and reject overlap with configured inventory names
hosts=$(printf '%s\n' "${HOSTS[@]}" | sort -u)
for h in $hosts; do
  grep -F "bootstrap.remote.hosts.$h" mise.toml >/dev/null 2>&1 && { echo "duplicate target: $h" >&2; exit 1; }
done

Prevention

When it happens

Trigger: 'mise bootstrap remote --all --host user@host1' where host1 also resolves from [bootstrap.remote.hosts]; the same --host given twice; --host whose normalized name equals a configured inventory name; a --tag that selects a host also passed explicitly.

Common situations: Wrapper scripts that always append --host on top of a configured fleet; loops emitting duplicated entries; tags that overlap explicit host names.

Related errors


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