jdx/mise · error

Either --url or --platform-url must be specified

Error message

Either --url or --platform-url must be specified

What it means

`mise generate tool-stub` requires knowing where to fetch the tool. At the start of `generate_stub`, mise checks that either `--url` was provided or at least one `--platform-url` entry exists; if both are missing it bails with this error. The stub must reference a downloadable source, so generation cannot proceed without one.

Solutions

  1. Add `--url <download-url>` for a platform-independent source
  2. Add one or more `--platform-url <platform>=<url>` entries for per-platform sources
  3. Check `mise generate tool-stub --help` for exact flag spelling

Example fix

// before
mise generate tool-stub --output ./stubs/ripgrep.toml
// after
mise generate tool-stub --output ./stubs/ripgrep.toml --url https://github.com/BurntSushi/ripgrep/releases/download/14.1.0
Defensive patterns

Strategy: validation

Validate before calling

if (!args.url && (!args.platformUrls || args.platformUrls.length === 0)) {
  throw new Error('mise generate tool-stub requires --url or --platform-url');
}

Try / catch

try {
  await exec('mise generate tool-stub ' + flags);
} catch (e) {
  if (String(e).includes('--url or --platform-url must be specified')) {
    flags += ' --url ' + requiredUrl;
    await exec('mise generate tool-stub ' + flags);
  }
}

Prevention

When it happens

Trigger: Running `mise generate tool-stub` with neither `--url` nor any `--platform-url platform=url` arguments, e.g. only passing `--output`, `--version`, or `--bin` flags.

Common situations: Users forget the URL flag when scripting stub generation; copying an example command that only showed platform URLs but omitting them; typos like `--platform_url` or `-platform-url` that the CLI ignores or misparses.

Understand the failure class

Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.

Related errors


AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17). Data as JSON: /api/errors/be2957ae28bf1d91. Report an issue: GitHub.

Appendix: source

Thrown at src/cli/generate/tool_stub.rs:264

            ),
            Err(err) if matches!(err.kind(), ErrorKind::NotFound | ErrorKind::NotADirectory) => {}
            Err(err) => return Err(err.into()),
        }
        Ok(())
    }

    fn get_tool_name(&self) -> String {
        self.output
            .file_name()
            .and_then(|name| name.to_str())
            .unwrap_or("tool")
            .to_string()
    }

    async fn generate_stub(&self) -> Result<String> {
        // Validate that either URL or platform URLs are provided
        if self.url.is_none() && self.platform_url.is_empty() {
            bail!("Either --url or --platform-url must be specified");
        }

        // Read existing file if it exists
        let (existing_content, mut doc) = if self.output.exists() {
            let content = file::read_to_string(&self.output)?;
            let toml_content = extract_toml_from_stub(&content);

            let document = toml_content.parse::<DocumentMut>()?;
            (Some(content), document)
        } else {
            (None, DocumentMut::new())
        };

        // If file exists but we're trying to set a different version, bail
        if existing_content.is_some() && doc.get("version").is_some() {
            let existing_version = doc.get("version").and_then(|v| v.as_str()).unwrap_or("");
            if existing_version != self.version {
                bail!(

View on GitHub (pinned to 533346cc37)