{"record":{"id":"3b54fc49081736a4","repo":"oven-sh/bun","slug":"notlittleendian","errorCode":"NotLittleEndian","errorMessage":"NotLittleEndian","messagePattern":"NotLittleEndian","errorType":"error_code","errorClass":"ElfError","httpStatus":null,"severity":"error","filePath":"src/exe_format/elf.rs","lineNumber":27,"sourceCode":"use core::mem::size_of;\n#[cfg(any(target_os = \"linux\", target_os = \"android\"))]\nuse core::sync::atomic::{AtomicU8, Ordering};\n\n#[cfg(any(target_os = \"linux\", target_os = \"android\"))]\nuse bun_core::env_var;\nuse bun_core::{slice_to_nul, strings};\n\nuse crate::{align_up, read_struct, write_struct};\n\nbun_core::declare_scope!(elf, visible);\n\n#[derive(Debug, thiserror::Error, strum::IntoStaticStr)]\npub enum ElfError {\n    #[error(\"InvalidElfFile\")]\n    InvalidElfFile,\n    #[error(\"Not64Bit\")]\n    Not64Bit,\n    #[error(\"NotLittleEndian\")]\n    NotLittleEndian,\n    #[error(\"BunSectionNotFound\")]\n    BunSectionNotFound,\n    #[error(\"NoWritableLoadSegment\")]\n    NoWritableLoadSegment,\n    #[error(\"NewVaddrCollides\")]\n    NewVaddrCollides,\n}\n\npub struct ElfFile {\n    pub data: Vec<u8>,\n}\n\nimpl ElfFile {\n    pub fn init(data: Vec<u8>) -> Result<Box<ElfFile>, ElfError> {\n        validate_elf64_le(&data)?;\n        Ok(Box::new(ElfFile { data }))\n    }","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/src/exe_format/elf.rs#L9-L45","documentation":"ElfError variant: the ELF header declares big- or mixed-endian byte order (EI_DATA != ELFDATA2LSB). The exe_format writer serializes section data assuming little-endian layout, so non-little-endian inputs are rejected before any section patching is attempted.","triggerScenarios":"Thrown at src/exe_format/elf.rs:27 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Target a little-endian 64-bit architecture when producing the executable","If big-endian support is required, add byte-order-aware read/write paths to exe_format before lifting this restriction"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","contentChangedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}