{"record":{"id":"be2957ae28bf1d91","repo":"jdx/mise","slug":"either-url-or-platform-url-must-be-specified","errorCode":null,"errorMessage":"Either --url or --platform-url must be specified","messagePattern":"Either --url or --platform-url must be specified","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/tool_stub.rs","lineNumber":264,"sourceCode":"            ),\n            Err(err) if matches!(err.kind(), ErrorKind::NotFound | ErrorKind::NotADirectory) => {}\n            Err(err) => return Err(err.into()),\n        }\n        Ok(())\n    }\n\n    fn get_tool_name(&self) -> String {\n        self.output\n            .file_name()\n            .and_then(|name| name.to_str())\n            .unwrap_or(\"tool\")\n            .to_string()\n    }\n\n    async fn generate_stub(&self) -> Result<String> {\n        // Validate that either URL or platform URLs are provided\n        if self.url.is_none() && self.platform_url.is_empty() {\n            bail!(\"Either --url or --platform-url must be specified\");\n        }\n\n        // Read existing file if it exists\n        let (existing_content, mut doc) = if self.output.exists() {\n            let content = file::read_to_string(&self.output)?;\n            let toml_content = extract_toml_from_stub(&content);\n\n            let document = toml_content.parse::<DocumentMut>()?;\n            (Some(content), document)\n        } else {\n            (None, DocumentMut::new())\n        };\n\n        // If file exists but we're trying to set a different version, bail\n        if existing_content.is_some() && doc.get(\"version\").is_some() {\n            let existing_version = doc.get(\"version\").and_then(|v| v.as_str()).unwrap_or(\"\");\n            if existing_version != self.version {\n                bail!(","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/cli/generate/tool_stub.rs#L246-L282","documentation":"`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.","triggerScenarios":"Running `mise generate tool-stub` with neither `--url` nor any `--platform-url platform=url` arguments, e.g. only passing `--output`, `--version`, or `--bin` flags.","commonSituations":"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.","solutions":["Add `--url <download-url>` for a platform-independent source","Add one or more `--platform-url <platform>=<url>` entries for per-platform sources","Check `mise generate tool-stub --help` for exact flag spelling"],"exampleFix":"// before\nmise generate tool-stub --output ./stubs/ripgrep.toml\n// after\nmise generate tool-stub --output ./stubs/ripgrep.toml --url https://github.com/BurntSushi/ripgrep/releases/download/14.1.0","handlingStrategy":"validation","validationCode":"if (!args.url && (!args.platformUrls || args.platformUrls.length === 0)) {\n  throw new Error('mise generate tool-stub requires --url or --platform-url');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await exec('mise generate tool-stub ' + flags);\n} catch (e) {\n  if (String(e).includes('--url or --platform-url must be specified')) {\n    flags += ' --url ' + requiredUrl;\n    await exec('mise generate tool-stub ' + flags);\n  }\n}","preventionTips":["Always pass --url or at least one --platform-url when scripting stub generation","Copy full example commands, not partial flag lists","Verify flag spelling against `mise generate tool-stub --help`"],"tags":["cli","tool-stub","missing-argument"],"backgroundTag":"missing-required-flag","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}