jdx/mise · error · eyre::Report

remote platform response is invalid

Error message

remote platform response is invalid

What it means

Thrown by parse_remote_platform when the response is structurally malformed: the OS or arch line is empty, or there are extra lines beyond the expected three. The classic cause is remote shell startup noise — .bashrc/.profile or sshd banners printing MOTD/debug text during the non-interactive sh -c probe — so the parser sees a fourth line and rejects the whole response.

Source

Thrown at src/system/remote.rs:1193

    printf '%s\n' "${libc:-unknown}"
    ;;
  *) printf '%s\n' none ;;
esac"#
}

fn parse_remote_platform(output: &str) -> Result<RemotePlatform> {
    let mut lines = output.lines();
    let os = normalize_os(lines.next().unwrap_or_default());
    let arch = normalize_arch(lines.next().unwrap_or_default());
    let libc = match (os.as_str(), lines.next()) {
        ("linux", Some("glibc")) => Some(LibcFlavor::Glibc),
        ("linux", Some("musl")) => Some(LibcFlavor::Musl),
        ("linux", _) => bail!("remote Linux libc family could not be identified"),
        (_, Some("none")) => None,
        _ => bail!("remote platform response is incomplete"),
    };
    if os.is_empty() || arch.is_empty() || lines.next().is_some() {
        bail!("remote platform response is invalid");
    }
    Ok(RemotePlatform { os, arch, libc })
}

#[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]
struct AbiVersion(Vec<u32>);

impl fmt::Display for AbiVersion {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        f.write_str(
            &self
                .0
                .iter()
                .map(u32::to_string)
                .collect::<Vec<_>>()
                .join("."),
        )
    }

View on GitHub (pinned to 6f52dcdf99)

Solutions

  1. Guard remote rc files so they print only for interactive shells: case $- in *i*) ... ;; esac
  2. Verify with: ssh <host> 'uname -s; uname -m; echo done' — anything beyond the expected lines must be silenced
  3. Set remote_mise or bootstrap_command to avoid platform detection if the noise cannot be removed

Example fix

# before (~/.bashrc on remote)
echo "Welcome to buildserver!"
fortune

# after
case $- in *i*) ;; *) return ;; esac
echo "Welcome to buildserver!"
fortune
Defensive patterns

Strategy: validation

Validate before calling

# Detect shell-startup noise before it corrupts platform detection:
out=$(ssh deploy@srv 'sh -c "uname -s; uname -m; echo sentinel"')
[ "$(printf '%s\n' "$out" | wc -l)" -eq 3 ] || echo "remote prints extra output during non-interactive ssh - silence rc files"

Type guard

fn is_wellformed_platform_output(output: &str) -> bool {
    let mut lines = output.lines();
    let os = lines.next().unwrap_or_default();
    let arch = lines.next().unwrap_or_default();
    let third = lines.next();
    !os.trim().is_empty() && !arch.trim().is_empty() && third.is_some() && lines.next().is_none()
}

Prevention

When it happens

Trigger: Remote login rc files (e.g. a .bashrc that echoes text unconditionally) emit output during 'ssh host sh -c ...'; system login banners configured for non-interactive sessions; any extra stdout line from the remote side of the probe.

Common situations: Shared servers with decorative .bashrc content (fortune, weather scripts, echo statements); hardened sshd with forced command wrappers; monitoring agents that print to sessions.

Related errors


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