wasmerio/wasmer · error
failed to register unwind information
Error message
failed to register unwind information
What it means
During copy_function, after copying a compiled function body into code memory, unwind information (e.g. Windows X64 unwind info) is registered with the unwind registry; the code .expect()s success because missing unwind info breaks stack unwinding/profiling. A panic here means the registry rejected the registration.
Source
Thrown at lib/compiler/src/engine/code_memory.rs:220
body.copy_from_slice(func.body());
let vmfunc = Self::view_as_mut_vmfunc_slice(body);
let unwind_info = func.unwind_info().map(|o| o.get());
if let Some(CompiledFunctionUnwindInfoReference::WindowsX64(info)) = unwind_info {
// Windows unwind information is written following the function body
// Keep unwind information 32-bit aligned (round up to the nearest 4 byte boundary)
let unwind_start = func_len.next_multiple_of(4);
let unwind_size = info.len();
let padding = unwind_start - func_len;
assert!((func_len + padding).is_multiple_of(4));
let slice = remainder.split_at_mut(padding + unwind_size).0;
slice[padding..].copy_from_slice(info);
}
if let Some(ref info) = unwind_info {
registry
.register(vmfunc.as_ptr() as usize, 0, func_len as u32, info)
.expect("failed to register unwind information");
}
vmfunc
}
/// Convert mut a slice from u8 to VMFunctionBody.
fn view_as_mut_vmfunc_slice(slice: &mut [u8]) -> &mut [VMFunctionBody] {
let byte_ptr: *mut [u8] = slice;
let body_ptr = byte_ptr as *mut [VMFunctionBody];
unsafe { &mut *body_ptr }
}
/// Register the frame info, so it's free when the memory gets freed
pub fn register_frame_info(&mut self, frame_info: GlobalFrameInfoRegistration) {
self.frame_info_registration = Some(frame_info);
}
}
View on GitHub (pinned to 8c4b9ee9d3)
Solutions
- Regenerate the compilation artifacts for the exact target platform (don't reuse cross-compiled caches)
- Upgrade wasmer; unwind registration bugs on specific targets have been fixed in patches
- Disable unwind info generation if your target allows (compile without unwind info) and verify stack walking is not needed
- Report with target triple and module if the failure persists — indicates an internal unwind-info bug
Defensive patterns
Strategy: try-catch
Try / catch
std::panic::catch_unwind(|| engine.publish_artifact(funcs, unwind))
.map_err(|_| anyhow::anyhow!("unwind registration failed on this target"))? Prevention
- Always compile artifacts for the exact target triple that will load them
- Delete stale compilation caches when upgrading OS or wasmer versions
- On Windows x64, verify unwind info generation settings in the toolchain
- Test module loading on the real target platform in CI
When it happens
Trigger: Calling copy_function (triggered when publishing compiled module code) when registry.register fails — typically on Windows x64 with malformed or misaligned unwind info, or duplicate/conflicting registration ranges.
Common situations: Windows x64 targets with RtlAddFunctionTable-style failures; compiled functions whose func_len or pointer ranges are misaligned; cross-target artifacts compiled for a different architecture.
Related errors
- Unsupported libcall
- The relocation {reloc} is not yet supported.
- wasi::platform_clock_time_get(wasi::Clockid::ProcessCputimeI
- wasi::platform_clock_time_get(wasi::Clockid::ThreadCputimeId
- unable to make memory readonly and executable
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/453b60cfb14771d5.
Report an issue: GitHub.