jdx/mise · error

unsupported ELF byte order

Error message

unsupported ELF byte order

What it means

`elf_interpreter` reads EI_DATA (byte 5) of the ELF header to determine byte order; it accepts only 1 (little-endian) or 2 (big-endian). Any other value means the file's ELF header is malformed, so the parser cannot safely read multi-byte fields like program header offsets and bails out. This protects against parsing garbage or a deliberately mangled file.

Solutions

  1. Re-download/reinstall the mise binary and retry — a valid build always has a valid EI_DATA byte
  2. Verify integrity against the published checksum before use (`sha256sum` vs release manifest)
  3. Check disk space and the download tool's exit status to rule out truncation/corruption

Example fix

// before
# binary corrupted mid-download
curl -fLo mise https://github.com/jdx/mise/releases/latest/download/mise-linux-x64
// after
# re-download with checksum verification
curl -fLo mise <url> && echo '<expected-sha256>  mise' | sha256sum -c -
Defensive patterns

Strategy: validation

Validate before calling

fn valid_elf_endianness(bytes: &[u8]) -> bool {
    matches!(bytes.get(5), Some(1) | Some(2))
}

Type guard

fn is_supported_elf_header(bytes: &[u8]) -> bool {
    bytes.starts_with(b"\\x7fELF") && matches!(bytes.get(4), Some(1) | Some(2))
        && matches!(bytes.get(5), Some(1) | Some(2))
}

Try / catch

if !valid_elf_endianness(&bytes) {
    // re-fetch the binary from the official source before retrying
    redownload_mise_binary()?;
}

Prevention

When it happens

Trigger: Calling the remote bootstrap path with a file that has ELF magic at bytes 0-3 but a corrupt/invalid EI_DATA byte at offset 5 — typically a corrupted download, a truncated or bit-flipped binary, or fuzzed/test data.

Common situations: Partial or interrupted downloads of the mise binary (curl interrupted, disk full); tools that wrote junk after the magic bytes; manually edited or patch-modified binaries.

Understand the failure class

Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at src/system/remote.rs:1886

        if bytes.get(offset) != Some(&b'.') {
            break;
        }
        offset += 1;
    }
    (!components.is_empty()).then_some(AbiVersion(components))
}

fn elf_interpreter(bytes: &[u8]) -> Result<Option<String>> {
    const ELF_MAGIC: &[u8] = b"\x7fELF";
    const PT_INTERP: u64 = 3;
    if !bytes.starts_with(ELF_MAGIC) {
        bail!("local mise is not an ELF executable");
    }
    let class = *bytes.get(4).ok_or_else(|| eyre!("truncated ELF header"))?;
    let little_endian = match bytes.get(5) {
        Some(1) => true,
        Some(2) => false,
        _ => bail!("unsupported ELF byte order"),
    };
    let (program_offset, entry_size, entry_count, offset_field, size_field) = match class {
        1 => (
            read_elf_int(bytes, 28, 4, little_endian)?,
            read_elf_int(bytes, 42, 2, little_endian)?,
            read_elf_int(bytes, 44, 2, little_endian)?,
            4,
            16,
        ),
        2 => (
            read_elf_int(bytes, 32, 8, little_endian)?,
            read_elf_int(bytes, 54, 2, little_endian)?,
            read_elf_int(bytes, 56, 2, little_endian)?,
            8,
            32,
        ),
        _ => bail!("unsupported ELF class"),
    };

View on GitHub (pinned to 533346cc37)