{"record":{"id":"b8c5b7be163b037c","repo":"jdx/mise","slug":"local-mise-is-not-an-elf-executable","errorCode":null,"errorMessage":"local mise is not an ELF executable","messagePattern":"local mise is not an ELF executable","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":1880,"sourceCode":"        }\n        let component = std::str::from_utf8(&bytes[start..offset])\n            .ok()?\n            .parse()\n            .ok()?;\n        components.push(component);\n        if bytes.get(offset) != Some(&b'.') {\n            break;\n        }\n        offset += 1;\n    }\n    (!components.is_empty()).then_some(AbiVersion(components))\n}\n\nfn elf_interpreter(bytes: &[u8]) -> Result<Option<String>> {\n    const ELF_MAGIC: &[u8] = b\"\\x7fELF\";\n    const PT_INTERP: u64 = 3;\n    if !bytes.starts_with(ELF_MAGIC) {\n        bail!(\"local mise is not an ELF executable\");\n    }\n    let class = *bytes.get(4).ok_or_else(|| eyre!(\"truncated ELF header\"))?;\n    let little_endian = match bytes.get(5) {\n        Some(1) => true,\n        Some(2) => false,\n        _ => bail!(\"unsupported ELF byte order\"),\n    };\n    let (program_offset, entry_size, entry_count, offset_field, size_field) = match class {\n        1 => (\n            read_elf_int(bytes, 28, 4, little_endian)?,\n            read_elf_int(bytes, 42, 2, little_endian)?,\n            read_elf_int(bytes, 44, 2, little_endian)?,\n            4,\n            16,\n        ),\n        2 => (\n            read_elf_int(bytes, 32, 8, little_endian)?,\n            read_elf_int(bytes, 54, 2, little_endian)?,","sourceCodeStart":1862,"sourceCodeEnd":1898,"githubUrl":"https://github.com/jdx/mise/blob/533346cc374382b41ec5ff70536252b2e96e725c/src/system/remote.rs#L1862-L1898","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Run a Linux mise build for this code path — verify with `file $(which mise)` that it reports 'ELF executable'","Reinstall mise from the official release so the binary is a real ELF file and not a truncated/corrupt download","Use a non-remote workflow (run mise locally) when the host binary is macOS/Windows, since ELF introspection does not apply"],"exampleFix":"// before (shell)\n# mise is a macOS Mach-O binary being pushed to a Linux remote\n./target/universal/mise remote-upload ssh://host\n// after\n# build/pick the linux-x86_64 (ELF) mise binary instead\nfile ~/.local/bin/mise  # -> ELF 64-bit LSB executable\ncp mise-linux-x64 ~/.local/bin/mise","handlingStrategy":"validation","validationCode":"const bytes = std.fs.read_file(\"/proc/self/exe\")?;\nif !bytes.starts_with(b\"\\\\x7fELF\") {\n    // do not attempt ELF interpreter extraction / remote bootstrap\n    eprintln!(\"mise binary is not ELF; skipping remote bootstrap\");\n    return;\n}","typeGuard":"fn is_elf(bytes: &[u8]) -> bool {\n    bytes.len() >= 4 && &bytes[..4] == b\"\\\\x7fELF\"\n}","tryCatchPattern":"match elf_interpreter(&bytes) {\n    Ok(interp) => use_interp(interp),\n    Err(e) if e.to_string().contains(\"not an ELF executable\") => {\n        // fall back to plain upload without interpreter reuse\n        fallback_upload();\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Deploy the Linux ELF build of mise on Linux hosts (`file $(which mise)` says ELF)","Keep shims/scripts out of the path that remote bootstrap reads — point it at the real binary","Verify binary integrity with checksums after download"],"tags":["remote","elf","binary","linux"],"backgroundTag":"unsupported-platform","analyzedSha":"533346cc374382b41ec5ff70536252b2e96e725c","analyzedAt":"2026-09-17T13:35:38.149Z","contentChangedAt":"2026-09-17T13:35:38.149Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}