oven-sh/bun · error · MachoError
InvalidLinkeditOffset
Error message
InvalidLinkeditOffset
What it means
MachoError variant: a value intended to be written into (or validated against) the __LINKEDIT region does not lie within that segment's file range, so the writer would place data outside the segment it claims to belong to. Typically follows from inconsistent load-command offsets in a hand-edited or corrupted binary.
Solutions
- Rebuild the executable so load commands are internally consistent
- Relax or fix the range validation in macho.rs if the layout is valid but uses an unconventional __LINKEDIT arrangement
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/exe_format/macho.rs:24 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/1bb776f153351c17.
Report an issue: GitHub.
Appendix: source
Thrown at src/exe_format/macho.rs:24
use crate::macho_types::{BlobIndex, CodeDirectory, SuperBlob};
use crate::{read_struct, write_struct};
use bun_core::env_var::feature_flag;
const SEGNAME_BUN: [u8; 16] = *b"__BUN\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
const SECTNAME: [u8; 16] = *b"__bun\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
#[derive(Debug, Copy, Clone, PartialEq, Eq, thiserror::Error, strum::IntoStaticStr)]
pub enum MachoError {
#[error("InvalidObject")]
InvalidObject,
#[error("MissingLinkeditSegment")]
MissingLinkeditSegment,
#[error("OffsetOutOfRange")]
OffsetOutOfRange,
#[error("OffsetOverflow")]
OffsetOverflow,
#[error("InvalidLinkeditOffset")]
InvalidLinkeditOffset,
#[error("OverlappingSegments")]
OverlappingSegments,
#[error("MissingRequiredSegment")]
MissingRequiredSegment,
#[error("OutOfMemory")]
OutOfMemory,
}
bun_core::oom_from_alloc!(MachoError);
pub struct MachoFile {
pub(crate) header: macho::mach_header_64,
pub(crate) data: Vec<u8>,
pub(crate) segment: macho::segment_command_64,
pub(crate) section: macho::section_64,
}
/// Expands to one `shift_one` call per named field.View on GitHub (pinned to 8c5296ac45)