{"record":{"id":"453b60cfb14771d5","repo":"wasmerio/wasmer","slug":"failed-to-register-unwind-information","errorCode":null,"errorMessage":"failed to register unwind information","messagePattern":"failed to register unwind information","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/compiler/src/engine/code_memory.rs","lineNumber":220,"sourceCode":"        body.copy_from_slice(func.body());\n        let vmfunc = Self::view_as_mut_vmfunc_slice(body);\n\n        let unwind_info = func.unwind_info().map(|o| o.get());\n        if let Some(CompiledFunctionUnwindInfoReference::WindowsX64(info)) = unwind_info {\n            // Windows unwind information is written following the function body\n            // Keep unwind information 32-bit aligned (round up to the nearest 4 byte boundary)\n            let unwind_start = func_len.next_multiple_of(4);\n            let unwind_size = info.len();\n            let padding = unwind_start - func_len;\n            assert!((func_len + padding).is_multiple_of(4));\n            let slice = remainder.split_at_mut(padding + unwind_size).0;\n            slice[padding..].copy_from_slice(info);\n        }\n\n        if let Some(ref info) = unwind_info {\n            registry\n                .register(vmfunc.as_ptr() as usize, 0, func_len as u32, info)\n                .expect(\"failed to register unwind information\");\n        }\n\n        vmfunc\n    }\n\n    /// Convert mut a slice from u8 to VMFunctionBody.\n    fn view_as_mut_vmfunc_slice(slice: &mut [u8]) -> &mut [VMFunctionBody] {\n        let byte_ptr: *mut [u8] = slice;\n        let body_ptr = byte_ptr as *mut [VMFunctionBody];\n        unsafe { &mut *body_ptr }\n    }\n\n    /// Register the frame info, so it's free when the memory gets freed\n    pub fn register_frame_info(&mut self, frame_info: GlobalFrameInfoRegistration) {\n        self.frame_info_registration = Some(frame_info);\n    }\n}\n","sourceCodeStart":202,"sourceCodeEnd":238,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/compiler/src/engine/code_memory.rs#L202-L238","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"std::panic::catch_unwind(|| engine.publish_artifact(funcs, unwind))\n    .map_err(|_| anyhow::anyhow!(\"unwind registration failed on this target\"))?","preventionTips":["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"],"tags":["unwind","windows","panic","compiler"],"backgroundTag":"unwind-info-registration-failed","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}