{"record":{"id":"2c3bba2edcefbe8e","repo":"jdx/mise","slug":"could-not-auto-detect-platform-from-url-pleas","errorCode":null,"errorMessage":"Could not auto-detect platform from URL: {}. Please specify explicitly using 'platform:url' format.","messagePattern":"Could not auto-detect platform from URL: (.+?)\\. Please specify explicitly using 'platform:url' format\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cli/generate/tool_stub.rs","lineNumber":514,"sourceCode":"__mise_tool_stub_bootstrap\n\nexec \"$MISE_BIN\" tool-stub \"$0\" \"$@\"\n\"##\n        ))\n    }\n\n    fn parse_platform_spec(&self, spec: &str) -> Result<(String, String)> {\n        // Check if this is a URL first (auto-detect case)\n        if spec.starts_with(\"http://\") || spec.starts_with(\"https://\") {\n            // Format: url (auto-detect platform)\n            let url = spec.to_string();\n\n            if let Some(detected_platform) = detect_platform_from_url(&url) {\n                let platform = detected_platform.to_platform_string();\n                debug!(\"Auto-detected platform '{}' from URL: {}\", platform, url);\n                Ok((platform, url))\n            } else {\n                bail!(\n                    \"Could not auto-detect platform from URL: {}. Please specify explicitly using 'platform:url' format.\",\n                    url\n                );\n            }\n        } else {\n            // Format: platform:url\n            let parts: Vec<&str> = spec.splitn(2, ':').collect();\n            if parts.len() != 2 {\n                bail!(\n                    \"Platform spec must be in format 'platform:url' or just 'url' (for auto-detection). Got: {}\",\n                    spec\n                );\n            }\n\n            let platform = parts[0].to_string();\n            let url = parts[1].to_string();\n            Ok((platform, url))\n        }","sourceCodeStart":496,"sourceCodeEnd":532,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/cli/generate/tool_stub.rs#L496-L532","documentation":"When a --platform-url value is a bare URL (no `platform:` prefix), mise tries `detect_platform_from_url` to guess the platform from the release filename (e.g. `tool-linux-x64.tar.gz`). If the filename contains no recognizable OS/arch tokens, detection returns None and generation aborts, asking you to state the platform explicitly.","triggerScenarios":"URLs whose filenames lack platform markers, e.g. `https://example.com/downloads/tool-v1.0.0.tar.gz`; plain-source-tarball style names like `tool-1.2.3.tar.xz`; custom release naming that spells platforms unconventionally (`linux_amd64` variants not covered by the matcher).","commonSituations":"Pointing the stub generator at a project's own release artifacts instead of conventional gorelester/cargo-dist style names; single-platform projects that never encoded the OS in the filename.","solutions":["Prefix the URL with an explicit platform: `--platform-url linux-x64:https://example.com/tool-1.0.0.tar.gz`","Check the platform spelling mise expects (e.g. linux-x64, linux-arm64, osx-arm64, windows-x64) and retry auto-detection with a conventionally named artifact","Inspect src/backend/asset_matcher.rs detect_platform_from_url patterns to see which filename tokens are recognized, then rename your release artifacts accordingly"],"exampleFix":"# before\nmise generate tool-stub ./ctl --platform-url https://example.com/dist/ctl-1.0.0.tar.gz\n# after\nmise generate tool-stub ./ctl --platform-url linux-x64:https://example.com/dist/ctl-1.0.0.tar.gz","handlingStrategy":"validation","validationCode":"#!/usr/bin/env bash\n# heuristically mirror detect_platform_from_url: require an os+arch token in the filename\nurl=\"$1\"\nbase=$(basename \"$url\")\nif ! grep -qE '(linux|darwin|osx|macos|windows|win).*(x64|x86_64|amd64|arm64|aarch64)|(x64|x86_64|amd64|arm64|aarch64).*(linux|darwin|osx|macos|windows|win)' <<<\"$base\"; then\n  echo \"filename lacks platform tokens; pass platform:url explicitly\" >&2\n  exit 2\nfi\nmise generate tool-stub ./out --platform-url \"$url\"","typeGuard":null,"tryCatchPattern":"if ! mise generate tool-stub ./out --platform-url \"$url\" 2>err.log; then grep -q 'Could not auto-detect platform' err.log && mise generate tool-stub ./out --platform-url \"$PLATFORM:$url\"; fi","preventionTips":["Prefer explicit platform:url in scripts; rely on auto-detection only interactively","Name release artifacts with conventional os/arch tokens so detection works"],"tags":["cli","tool-stub","platform-detection","mise"],"backgroundTag":"platform-detection-failed","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}