jdx/mise · error
--from was provided
Error message
--from was provided
What it means
A `.expect()` panic in mise's bootstrap repo source resolution (src/cli/bootstrap.rs:1921). The code resolves the bootstrap source either from a configured URL or from the `--from` CLI flag; the else branch asserts `--from` was provided. Panicking means neither the URL path nor `--from` was present, breaking the argument-parsing invariant.
Source
Thrown at src/cli/bootstrap.rs:1921
if !outcome.durable_access {
warn!("ongoing synchronization still needs credentials on this host (see above)");
}
return Ok(());
}
let (url, checkout) = if let Some(url) = expanded.as_deref() {
let checkout = crate::env::MISE_GLOBAL_CONFIG_FILE
.as_deref()
.map(|path| {
path.parent()
.filter(|parent| !parent.as_os_str().is_empty())
.unwrap_or_else(|| Path::new("."))
})
.unwrap_or(*dirs::CONFIG)
.to_path_buf();
(url, checkout)
} else {
(
self.from.as_deref().expect("--from was provided"),
self.from_dir
.clone()
.unwrap_or_else(|| dirs::DATA.join("bootstrap-repo")),
)
};
let checkout_is_empty = checkout.is_dir() && checkout.read_dir()?.next().is_none();
let reuse_checkout = checkout.exists() && !checkout_is_empty;
if reuse_checkout {
validate_bootstrap_checkout(&checkout, url)?;
}
// The clone or pull changes the config checkout before the child
// process records the bootstrap itself, so it is a generation of its
// own. A checkout reused as-is changes nothing and records nothing.
let mutates_checkout = !reuse_checkout || self.update;
let generation = if mutates_checkout {
Some(OperationScope::begin("bootstrap --from", self.dry_run).await?)
} else {View on GitHub (pinned to afd2eddd3a)
Solutions
- Pass `--from <url-or-path>` when no bootstrap source URL is configured
- Add the bootstrap source URL to the mise config so the first branch is taken
- Validate args at clap level: require --from unless a config URL is set (make it a clap-required group)
Example fix
// before
self.from.as_deref().expect("--from was provided")
// after
self.from.as_deref().with_context(|| "--from is required when no bootstrap source URL is configured")? Defensive patterns
Strategy: validation
Validate before calling
if bootstrap_source_url.is_none() && cli.from.is_none() { return Err(anyhow!("--from is required when no bootstrap source URL is configured")); } Type guard
let from = cli.from.as_deref().or(config.bootstrap_source_url.as_deref());
Try / catch
let from = match self.from.as_deref() { Some(f) => f, None => return Err(anyhow!("missing --from")), }; Prevention
- Use clap's required_unless_present to encode the --from/URL mutual dependency
- Document in `mise bootstrap --help` when --from is mandatory
- Check bootstrap config for a source URL before running the command
When it happens
Trigger: Running `mise bootstrap` without `--from` and without a config that selects a URL source, reaching the else branch with `self.from == None`.
Common situations: Invoking bootstrap from a config file path that lacks the source URL while omitting --from on the command line; older configs after a CLI change that made the URL source conditional.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- provider checked above
- BootstrapPart values have clap names
- bootstrap command is registered
- {flag} cannot be used with a bootstrap subcommand
- Either --url or --platform-url must be specified
AI-assisted analysis of jdx/mise@afd2eddd3a (2026-09-09).
Data as JSON: /api/errors/b4e75aff4a041f92.
Report an issue: GitHub.