{"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":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/remote.rs","lineNumber":1358,"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":1340,"sourceCodeEnd":1376,"githubUrl":"https://github.com/jdx/mise/blob/6f52dcdf99e282ef7a7db68c81301fa4618d0f79/src/system/remote.rs#L1340-L1376","documentation":"Thrown by elf_interpreter when the bytes of the binary being validated for a Linux remote do not start with the \\x7fELF magic. validate_default_binary_compatibility only runs for Linux-to-Linux uploads, so a non-ELF payload means the configured mise_bin is not a Linux executable — e.g. a shell wrapper script, a macOS Mach-O copied over, or a truncated/corrupted file.","triggerScenarios":"Setting mise_bin to a wrapper script or a wrong-platform binary (macOS mise) while the remote is Linux; a partially downloaded/corrupted local binary; a symlink target that is a script.","commonSituations":"Teams wrapping mise in a launcher script for env tweaks; copying binaries between platforms manually; disk/cache corruption or interrupted downloads.","solutions":["Point mise_bin at a real Linux ELF executable (file mise should say ELF 64-bit ... for Linux)","Re-download or rebuild the binary if it is truncated (compare size/checksum)","Remove script wrappers from the upload path; put env setup in mise_env or the remote config instead"],"exampleFix":"# before (mise.toml)\n[bootstrap.remote.hosts.srv]\nhost = \"deploy@srv\"\nmise_bin = \"./mise-wrapper.sh\"\n\n# after\n[bootstrap.remote.hosts.srv]\nhost = \"deploy@srv\"\nmise_bin = \"./mise\"  # file ./mise -> ELF 64-bit LSB executable, x86-64","handlingStrategy":"validation","validationCode":"// Validate the binary before pointing mise_bin at it (Linux remotes)\nfn is_linux_elf(path: &Path) -> bool {\n    let mut magic = [0u8; 6];\n    let Ok(mut f) = std::fs::File::open(path) else { return false };\n    std::io::Read::read_exact(&mut f, &mut magic).is_ok()\n        && &magic[..4] == b\"\\x7fELF\"\n}","typeGuard":"fn is_linux_elf(path: &Path) -> bool {\n    let mut magic = [0u8; 6];\n    let Ok(mut f) = std::fs::File::open(path) else { return false };\n    std::io::Read::read_exact(&mut f, &mut magic).is_ok()\n        && &magic[..4] == b\"\\x7fELF\"\n        && matches!(magic[4], 1 | 2)\n        && matches!(magic[5], 1 | 2)\n}","tryCatchPattern":"match elf_interpreter(&bytes) {\n    Err(e) if e.to_string().contains(\"not an ELF executable\") => {\n        // mise_bin points at a script or wrong-platform binary: fix config, don't retry\n        eyre::bail!(\"mise_bin must be a Linux ELF executable; got {}\", mise_bin.display());\n    }\n    other => other?,\n}","preventionTips":["Check 'file <binary>' shows 'ELF ... for Linux' before setting mise_bin","Never wrap mise in a shell script for upload; use mise_env for environment tweaks","Verify checksums after copying binaries between machines"],"tags":["mise","elf","binary-format","mise-bin","remote-bootstrap","validation"],"backgroundTag":"invalid-executable-format","analyzedSha":"6f52dcdf99e282ef7a7db68c81301fa4618d0f79","analyzedAt":"2026-08-22T10:14:23.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}