jdx/mise · error

Platform spec must be in format 'platform:url' or just…

Error message

Platform spec must be in format 'platform:url' or just 'url' (for auto-detection). Got: {}

What it means

This error is thrown by `parse_platform_spec` in the mise tool stub generator when a `--platform` argument is neither a bare URL (for auto-detection) nor a `platform:url` pair. The spec string is split once on ':' and if no colon-separated pair exists, parsing fails with this message including the offending spec. It exists to catch malformed platform overrides early before any download is attempted.

Solutions

  1. Change the --platform value to 'platform:url' form, e.g. --platform macos-x64:https://example.com/tool.tar.gz
  2. If you want platform auto-detection, pass only the URL with no platform prefix: --platform https://example.com/tool.tar.gz
  3. Quote the argument so the platform and URL stay in one shell word: --platform "linux:https://..."

Example fix

// before
--platform linux
// after
--platform linux:https://github.com/org/tool/releases/download/v1.0/tool-linux-amd64.tar.gz
Defensive patterns

Strategy: validation

Validate before calling

validate_platform_spec() {
  local spec="$1"
  if [[ "$spec" != *:* ]]; then
    echo "--platform must be 'platform:url' or a bare url" >&2
    return 1
  fi
}
validate_platform_spec "$PLATFORM_SPEC" || exit 1

Prevention

When it happens

Trigger: Running `mise generate tool-stub` with a `--platform` value that contains no ':' separator and is not a recognizable URL, e.g. `--platform macos` or `--platform linux-x64` (missing the download URL after the platform name).

Common situations: Hand-written platform mappings in shell scripts where the URL was accidentally dropped; copying an entry from another tool's config that used a different separator (space or '='); quoting mistakes that split the platform and URL into separate arguments.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

        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))
        }
    }

    fn parse_platform_bin_spec(&self, spec: &str) -> Result<(String, String)> {
        let parts: Vec<&str> = spec.splitn(2, ':').collect();
        if parts.len() != 2 {
            bail!(
                "Platform bin spec must be in format 'platform:path', got: {}",
                spec
            );

View on GitHub (pinned to 533346cc37)