oven-sh/bun · warning · bun_exe_format::pe::Error

InputIsSigned

Error message

InputIsSigned

What it means

A declared variant meaning 'the input executable carries an Authenticode signature that blocks modification'. In the current code it is never constructed anywhere in the tree (only the enum declaration at src/exe_format/pe.rs:31-32 exists) — the real pipeline instead strips signatures via strip_authenticode and reports InvalidSecurityDirectory/SecurityDirInsideImage/UnexpectedOverlayPresent when stripping fails. Treat any occurrence as an anomaly: a signed input could not be handled.

Source

Thrown at src/exe_format/pe.rs:31

    #[error("BadAlignment")]
    BadAlignment,
    #[error("Overflow")]
    Overflow,
    #[error("InvalidPEFile")]
    InvalidPEFile,
    #[error("InvalidDOSSignature")]
    InvalidDOSSignature,
    #[error("InvalidPESignature")]
    InvalidPESignature,
    #[error("UnsupportedPEFormat")]
    UnsupportedPEFormat,
    #[error("InsufficientHeaderSpace")]
    InsufficientHeaderSpace,
    #[error("TooManySections")]
    TooManySections,
    #[error("SectionExists")]
    SectionExists,
    #[error("InputIsSigned")]
    InputIsSigned,
    #[error("InvalidSecurityDirectory")]
    InvalidSecurityDirectory,
    #[error("SecurityDirInsideImage")]
    SecurityDirInsideImage,
    #[error("UnexpectedOverlayPresent")]
    UnexpectedOverlayPresent,
    #[error("InsufficientSpace")]
    InsufficientSpace,
}

/// Windows PE Binary manipulation for codesigning standalone executables
pub struct PEFile {
    pub(crate) data: Vec<u8>,
    // Store offsets instead of pointers to avoid invalidation after resize
    pub(crate) pe_header_offset: usize,
    pub(crate) optional_header_offset: usize,
    pub(crate) section_headers_offset: usize,

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. If you hit this in a match, handle it together with the security-directory errors (InvalidSecurityDirectory, SecurityDirInsideImage).
  2. If seen at runtime from an old build, upgrade Bun — current versions strip signatures automatically instead of failing.
  3. For signed inputs, prefer removing the signature yourself (osslsigncode remove / signtool remove) before compiling, then re-sign the output.
Defensive patterns

Strategy: validation

Validate before calling

# Check whether the base is Authenticode-signed before compiling
powershell Get-AuthenticodeSignature base.exe   # Status should be NotSigned
# or: osslsigncode verify base.exe

Prevention

When it happens

Trigger: No active code path throws it today. Historically it would correspond to refusing to modify a signed PE. The modern path (add_bun_section, src/exe_format/pe.rs:467-469) always calls strip_authenticode first and only errors when the signature data itself is malformed.

Common situations: Grepping the codebase or writing a match over bun_exe_format::pe::Error and needing exhaustive arms; seeing the string in old logs/builds from earlier Bun versions that did throw it on signed inputs.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/52d378bb5e688d94. Report an issue: GitHub.