jdx/mise · error

Invalid platform format '{}'. Expected 'os-arch' or 'os-arch

Error message

Invalid platform format '{}'. Expected 'os-arch' or 'os-arch-qualifier'

What it means

Platform strings must follow os-arch[-qualifier]; Platform::parse splits on '-' and bails when fewer than two parts exist — in practice, when the string contains no hyphen at all (split never yields zero parts; an empty string yields one). The string reaches parse via `mise lock -p/--platform` or the `lockfile_platforms` setting, both of which parse and then validate each entry.

Source

Thrown at src/platform.rs:20

use eyre::{Result, bail};
use std::{collections::BTreeMap, fmt};

/// Represents a target platform for lockfile operations
#[derive(Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub(crate) struct Platform {
    pub os: String,
    pub arch: String,
    pub qualifier: Option<String>,
}

impl Platform {
    /// Parse a platform string in the format "os-arch" or "os-arch-qualifier"
    /// Qualifier may contain hyphens (e.g., "musl-baseline")
    pub(crate) fn parse(platform_str: &str) -> Result<Self> {
        let parts: Vec<&str> = platform_str.split('-').collect();

        match parts.len() {
            0 | 1 => bail!(
                "Invalid platform format '{}'. Expected 'os-arch' or 'os-arch-qualifier'",
                platform_str
            ),
            2 => Ok(Platform {
                os: parts[0].to_string(),
                arch: parts[1].to_string(),
                qualifier: None,
            }),
            _ => {
                // Join remaining parts as qualifier (handles compound qualifiers like "musl-baseline")
                let qualifier = parts[2..].join("-");
                Ok(Platform {
                    os: parts[0].to_string(),
                    arch: parts[1].to_string(),
                    qualifier: Some(qualifier),
                })
            }
        }

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Write the full os-arch pair: linux-x64, linux-arm64, macos-arm64, windows-x64.
  2. Add a qualifier only when needed: linux-x64-musl or linux-x64-musl-baseline.
  3. Check the effective list with `mise settings` to find the offending entry.

Example fix

# before — mise.toml
[settings]
lockfile_platforms = ["linux", "macos"]

# after
[settings]
lockfile_platforms = ["linux-x64", "macos-arm64"]
Defensive patterns

Strategy: validation

Validate before calling

# Reject platform strings without the os-arch shape before invoking mise
for p in "${PLATFORMS[@]}"; do
  [[ "$p" =~ ^[a-z0-9]+-[a-z0-9]+(-[a-z0-9-]+)?$ ]] || { echo "bad platform: $p"; exit 2; }
done
mise lock -p "${PLATFORMS[@]}"

Type guard

fn has_os_arch_shape(s: &str) -> bool {
    s.split('-').count() >= 2
}

Prevention

When it happens

Trigger: `mise lock -p linux`, `mise lock -p x64`, `lockfile_platforms = ["linux"]`, or an accidental "" entry in the settings list — any value lacking the os-arch hyphen structure.

Common situations: Assuming a bare OS or arch is sufficient; pasting Go/Rust target fragments like "x86_64" that are a single token; config edits leaving empty strings behind.

Related errors


AI-assisted analysis of jdx/mise@6f52dcdf99 (2026-08-22). Data as JSON: /api/errors/a21e6800b5b3cd41. Report an issue: GitHub.