{"record":{"id":"b5b8d3a67c05b7a6","repo":"wasmerio/wasmer","slug":"module-info-requires-the-wasm-types-polyfill-featu","errorCode":null,"errorMessage":"module info requires the wasm-types-polyfill feature","messagePattern":"module info requires the wasm-types-polyfill feature","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/api/src/backend/js/entities/module.rs","lineNumber":608,"sourceCode":"            WebAssembly::Module::custom_sections(&self.module, name)\n                .iter()\n                .map(move |buf_val| {\n                    let typebuf: js_sys::Uint8Array = js_sys::Uint8Array::new(&buf_val);\n                    typebuf.to_vec().into_boxed_slice()\n                })\n                .collect::<Vec<Box<[u8]>>>()\n                .into_iter(),\n        )\n    }\n\n    pub(crate) fn info(&self) -> &ModuleInfo {\n        #[cfg(feature = \"wasm-types-polyfill\")]\n        {\n            &self.info\n        }\n        #[cfg(not(feature = \"wasm-types-polyfill\"))]\n        {\n            unimplemented!(\"module info requires the wasm-types-polyfill feature\")\n        }\n    }\n}\n\nimpl From<WebAssembly::Module> for Module {\n    #[track_caller]\n    fn from(module: WebAssembly::Module) -> Self {\n        Self {\n            module: JsHandle::new(module),\n            name: None,\n            type_hints: None,\n            #[cfg(feature = \"wasm-types-polyfill\")]\n            info: ModuleInfo::default(),\n            #[cfg(feature = \"js-serializable-module\")]\n            raw_bytes: None,\n        }\n    }\n}","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/api/src/backend/js/entities/module.rs#L590-L626","documentation":"`Module::info()` returns the internal wasm module metadata, but on the JS backend that information is only populated when the `wasm-types-polyfill` cargo feature is enabled. Without it, `info()` panics with this unimplemented stub.","triggerScenarios":"Calling `Module::info(&store)` on the js backend while the `wasm-types-polyfill` feature of the wasmer crate is not enabled in Cargo.toml.","commonSituations":"Code that inspects imports/exports/datas of a module compiled in the browser; the feature is off by default and easy to miss when enabling the `js` backend.","solutions":["Enable the feature: `wasmer = { version = \"...\", features = [\"js\", \"wasm-types-polyfill\"] }`","Avoid `Module::info()` in browser code; parse imports/exports with `web-sys`/`js_sys::WebAssembly::Module::imports/exports` directly","Compile the polyfill feature in only for the code path that needs module metadata"],"exampleFix":"// before (Cargo.toml)\nwasmer = { version = \"4\", features = [\"js\"] }\n// after\nwasmer = { version = \"4\", features = [\"js\", \"wasm-types-polyfill\"] }","handlingStrategy":"validation","validationCode":"// build-time check in build.rs or a test:\n// #[cfg(all(feature = \"js\", not(feature = \"wasm-types-polyfill\")))]\n// compile_error!(\"Module::info requires the wasm-types-polyfill feature\");","typeGuard":"fn module_info_available() -> bool {\n    cfg!(feature = \"wasm-types-polyfill\")\n}","tryCatchPattern":"if module_info_available() {\n    let info = module.info(&store);\n} else {\n    // fall back to js_sys::WebAssembly module inspection\n}","preventionTips":["Declare required features explicitly in Cargo.toml feature combos","Add a compile_error! guard tying js usage of Module::info to wasm-types-polyfill","Document feature requirements for module-inspection code paths"],"tags":["wasm","javascript-backend","feature-flag","module-metadata"],"backgroundTag":"missing-cargo-feature","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}