{"record":{"id":"8ce9f227d2bed227","repo":"wasmerio/wasmer","slug":"internal-error-resolution-record-for-symbol-name","errorCode":null,"errorMessage":"Internal error: resolution record for symbol {name} indicates non-function resolution {resolution:?}","messagePattern":"Internal error: resolution record for symbol (.+?) indicates non-function resolution (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/wasix/src/state/linker/instance_group/imports.rs","lineNumber":676,"sourceCode":"                                        ?requesting_module,\n                                        name,\n                                        ?resolved_from,\n                                        \"Updating linker state with this resolution\"\n                                    );\n\n                                    *resolved_guard = Some(Some(func.clone()));\n                                    linker_state.symbol_resolution_records.insert(\n                                        resolution_key,\n                                        SymbolResolutionResult::Function {\n                                            ty: func.ty(&store),\n                                            resolved_from,\n                                        },\n                                    );\n                                }\n\n                                func.clone()\n                            }\n                            Some(resolution) => panic!(\n                                \"Internal error: resolution record for symbol \\\n                                {name} indicates non-function resolution {resolution:?}\"\n                            ),\n                        }\n                    }\n                    Some(None) => return Err(mk_error()),\n                    Some(Some(ref func)) => func.clone(),\n                };\n                drop(resolved_guard);\n\n                let mut store = env.as_store_mut();\n                func.call(&mut store, params)\n                    .map(|ret| ret.into())\n                    .map_err(flatten_runtime_error)\n            },\n        )\n    }\n}","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/state/linker/instance_group/imports.rs#L658-L694","documentation":"This panic fires in generate_stub_function when the linker's resolution record for a requested import symbol points to something that is not a function, while the import being populated expects a function (and a stub function is being generated for it). The linker maintains a symbol->resolution map; if a caller (populate_imports_from_link_state / populate_imports_from_linker) tries to bind a function import against a non-function resolution (e.g. a global or memory), the internal invariant is broken and it aborts. It indicates corrupted or inconsistent linker state, not a problem with the user's WASI usage per se.","triggerScenarios":"Instantiating a module whose function-type import resolves to a symbol that was registered in the linker state as a global/memory/table; calling populate_imports_from_link_state or populate_imports_from_linker with a LinkerState whose symbol resolutions were mutated or built by a different linker instance.","commonSituations":"Mixing resolutions across multiple Linker/InstanceGroup instances; a host-defined symbol name shadowed by a non-function definition; bugs in custom dlopen-style dynamic linking flows where symbols were recorded with the wrong resolution kind.","solutions":["Verify the symbol name in the module's imports matches a function-kind definition in the linker (define_func, not define_global/memory)","Rebuild LinkerState from a single Linker instance; do not share resolution records between linkers or reuse stale link state","Check for typos/collisions where the same name was defined twice with different kinds; the last definition wins in the map","If it persists, capture the symbol name and resolution variant from the panic message and report it as a linker bug with a reproducer"],"exampleFix":"// before: same name registered as a global, module imports it as a func\nlinker.define(\"env\", \"callback\", Func::new(...));\nlinker.define(\"env\", \"callback\", Global::new(...)); // overwrite -> non-function resolution\n// after\nlinker.define(\"env\", \"callback\", Func::new(...)); // keep kinds consistent per symbol","handlingStrategy":"validation","validationCode":"fn assert_function_resolution(state: &LinkerState, name: &str) -> bool {\n    matches!(state.lookup(name), Some(Resolution::Function(_)))\n}\n// call before populate_imports_* for every function import\nif !assert_function_resolution(&state, \"env::callback\") {\n    return Err(format!(\"{name} is not registered as a function\"));\n}","typeGuard":"fn is_function_resolution(r: &Resolution) -> bool {\n    matches!(r, Resolution::Function(_))\n}","tryCatchPattern":null,"preventionTips":["Register each import name with exactly one definition kind (func stays func)","Never share LinkerState between Linker/InstanceGroup instances","Deduplicate symbol definitions to avoid kind overwrites","Log the resolution kind for each symbol before populating imports"],"tags":["linker","internal-invariant","wasm-imports","panic"],"backgroundTag":"linker-symbol-resolution-mismatch","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}