{"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":249,"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":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/generate/tool_stub.rs#L231-L267","documentation":"Thrown by `mise generate tool-stub` when neither --url nor any --platform-url is supplied. The generator builds a stub around at least one HTTP artifact URL; with no URL it has nothing to analyze (checksums, size, binary path) and refuses to run rather than emit an empty stub. Note --lock and --fetch are the only modes that legitimately skip URLs, and clap already conflicts them with url/platform_url.","triggerScenarios":"Running `mise generate tool-stub ./mystub` with only non-URL flags such as --bin, --version, or --bootstrap; passing --lock/--fetch together with a URL (clap conflict surfaces first); or a wrapper script that forgets to forward the URL argument.","commonSituations":"Automated stub-generation scripts where the URL variable is empty/unset; first-time use where the user assumes the command will prompt or default to something.","solutions":["Pass the artifact URL: `mise generate tool-stub ./tool --url https://example.com/tool-1.0.0-linux-x64.tar.gz`","Or pass platform-scoped URLs: `mise generate tool-stub ./tool --platform-url linux-x64:https://... --platform-url osx-arm64:https://...`","If you meant to operate on an existing stub, use `--fetch` (fill in checksums) or `--lock` (embed resolved lockfile data) instead of a URL"],"exampleFix":"# before\nmise generate tool-stub ./ctl\n# after\nmise generate tool-stub ./ctl --url https://github.com/owner/repo/releases/download/v1.0.0/ctl-linux-x64.tar.gz","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\nurl=\"${TOOL_URL:-}\"\nif [[ -z \"$url\" ]]; then\n  echo \"TOOL_URL is empty; refusing to run mise generate tool-stub\" >&2\n  exit 2\nfi\nmise generate tool-stub \"$1\" --url \"$url\"","typeGuard":null,"tryCatchPattern":"if ! mise generate tool-stub ./ctl --url \"$url\" 2>err.log; then grep -q -- '--url or --platform-url' err.log && echo \"stub generation missing URL\" >&2; exit 1; fi","preventionTips":["Fail fast in scripts when the URL variable is unset ([[ -z \"$url\" ]] && exit 2)","Remember only --lock and --fetch run without URLs; every other invocation needs one"],"tags":["cli","tool-stub","missing-argument","mise"],"backgroundTag":"missing-required-argument","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}