oven-sh/bun · error

ares_library_init_mem failed: {}

Error message

ares_library_init_mem failed: {}

What it means

Error "ares_library_init_mem failed: {}" thrown in oven-sh/bun.

Source

Thrown at src/cares_sys/c_ares.rs:965

            if readable { fd } else { ARES_SOCKET_BAD },
            if writable { fd } else { ARES_SOCKET_BAD },
        );
    }
}

fn library_init() {
    bun_core::run_once! {{
        // SAFETY: c-ares FFI; mimalloc fn pointers have C ABI matching ares_library_init_mem's contract.
        let rc = unsafe {
            ares_library_init_mem(
                ARES_LIB_INIT_ALL,
                Some(bun_alloc::mimalloc::mi_malloc),
                Some(bun_alloc::mimalloc::mi_free),
                Some(bun_alloc::mimalloc::mi_realloc),
            )
        };
        if rc != ARES_SUCCESS {
            panic!("ares_library_init_mem failed: {}", rc);
        }
    }}
}

pub(crate) type ares_callback =
    Option<unsafe extern "C" fn(*mut c_void, c_int, c_int, *mut u8, c_int)>;
pub(crate) type ares_host_callback =
    Option<unsafe extern "C" fn(*mut c_void, c_int, c_int, *mut struct_hostent)>;
pub(crate) type ares_nameinfo_callback =
    Option<unsafe extern "C" fn(*mut c_void, c_int, c_int, *mut u8, *mut u8)>;
pub(crate) type ares_addrinfo_callback =
    unsafe extern "C" fn(*mut c_void, c_int, c_int, *mut AddrInfo);

unsafe extern "C" {
    fn ares_library_init_mem(
        flags: c_int,
        amalloc: Option<unsafe extern "C" fn(usize) -> *mut c_void>,
        afree: Option<unsafe extern "C" fn(*mut c_void)>,

View on GitHub (pinned to 8c5296ac45)

When it happens

Trigger: Thrown at src/cares_sys/c_ares.rs:965 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/f198883453d175f8. Report an issue: GitHub.