jdx/mise · error

Could not auto-detect platform from URL: {}. Please specify

Error message

Could not auto-detect platform from URL: {}. Please specify explicitly using 'platform:url' format.

What it means

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.

Source

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

__mise_tool_stub_bootstrap

exec "$MISE_BIN" tool-stub "$0" "$@"
"##
        ))
    }

    fn parse_platform_spec(&self, spec: &str) -> Result<(String, String)> {
        // Check if this is a URL first (auto-detect case)
        if spec.starts_with("http://") || spec.starts_with("https://") {
            // Format: url (auto-detect platform)
            let url = spec.to_string();

            if let Some(detected_platform) = detect_platform_from_url(&url) {
                let platform = detected_platform.to_platform_string();
                debug!("Auto-detected platform '{}' from URL: {}", platform, url);
                Ok((platform, url))
            } else {
                bail!(
                    "Could not auto-detect platform from URL: {}. Please specify explicitly using 'platform:url' format.",
                    url
                );
            }
        } else {
            // Format: platform:url
            let parts: Vec<&str> = spec.splitn(2, ':').collect();
            if parts.len() != 2 {
                bail!(
                    "Platform spec must be in format 'platform:url' or just 'url' (for auto-detection). Got: {}",
                    spec
                );
            }

            let platform = parts[0].to_string();
            let url = parts[1].to_string();
            Ok((platform, url))
        }

View on GitHub (pinned to 9dcfcaa0dc)

Solutions

  1. Prefix the URL with an explicit platform: `--platform-url linux-x64:https://example.com/tool-1.0.0.tar.gz`
  2. 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
  3. Inspect src/backend/asset_matcher.rs detect_platform_from_url patterns to see which filename tokens are recognized, then rename your release artifacts accordingly

Example fix

# before
mise generate tool-stub ./ctl --platform-url https://example.com/dist/ctl-1.0.0.tar.gz
# after
mise generate tool-stub ./ctl --platform-url linux-x64:https://example.com/dist/ctl-1.0.0.tar.gz
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
# heuristically mirror detect_platform_from_url: require an os+arch token in the filename
url="$1"
base=$(basename "$url")
if ! 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
  echo "filename lacks platform tokens; pass platform:url explicitly" >&2
  exit 2
fi
mise generate tool-stub ./out --platform-url "$url"

Try / catch

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

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of jdx/mise@9dcfcaa0dc (2026-08-17). Data as JSON: /api/errors/2c3bba2edcefbe8e. Report an issue: GitHub.