jdx/mise · error

local mise is not an ELF executable

Error message

local mise is not an ELF executable

What it means

This error is thrown by `elf_interpreter` in src/system/remote.rs when parsing the local mise binary to find its ELF interpreter (needed to re-exec on a remote host). It fires when the bytes of the local executable do not start with the ELF magic sequence \"\\u{7f}ELF\", meaning the running mise binary is not an ELF executable (e.g. a macOS Mach-O binary, a shell script, or a corrupted/placeholder file). ELF parsing is only meaningful on Linux, so invoking this path with a non-ELF binary is an unsupported state.

Solutions

  1. Run a Linux mise build for this code path — verify with `file $(which mise)` that it reports 'ELF executable'
  2. Reinstall mise from the official release so the binary is a real ELF file and not a truncated/corrupt download
  3. Use a non-remote workflow (run mise locally) when the host binary is macOS/Windows, since ELF introspection does not apply

Example fix

// before (shell)
# mise is a macOS Mach-O binary being pushed to a Linux remote
./target/universal/mise remote-upload ssh://host
// after
# build/pick the linux-x86_64 (ELF) mise binary instead
file ~/.local/bin/mise  # -> ELF 64-bit LSB executable
cp mise-linux-x64 ~/.local/bin/mise
Defensive patterns

Strategy: validation

Validate before calling

const bytes = std.fs.read_file("/proc/self/exe")?;
if !bytes.starts_with(b"\\x7fELF") {
    // do not attempt ELF interpreter extraction / remote bootstrap
    eprintln!("mise binary is not ELF; skipping remote bootstrap");
    return;
}

Type guard

fn is_elf(bytes: &[u8]) -> bool {
    bytes.len() >= 4 && &bytes[..4] == b"\\x7fELF"
}

Try / catch

match elf_interpreter(&bytes) {
    Ok(interp) => use_interp(interp),
    Err(e) if e.to_string().contains("not an ELF executable") => {
        // fall back to plain upload without interpreter reuse
        fallback_upload();
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Running the remote bootstrap/upload path with a locally running mise binary that is not ELF: a macOS or Windows mise binary, a wrapper shell script, or a file whose first bytes are not the ELF magic.

Common situations: Cross-platform environments where the machine invoking remote upload is macOS (Mach-O binary); mise installed as a shim or script pointing at a non-ELF target; corrupted binary replaced by text (e.g. an HTML error page downloaded as the mise binary).

Understand the failure class

Background: "unsupported platform" / "not supported on this platform" errors: what they mean and how to fix them — this error's family across 47 libraries.

Related errors


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

Appendix: source

Thrown at src/system/remote.rs:1880

        }
        let component = std::str::from_utf8(&bytes[start..offset])
            .ok()?
            .parse()
            .ok()?;
        components.push(component);
        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)?,

View on GitHub (pinned to 533346cc37)