{"record":{"id":"02cac5c7996ecbf3","repo":"wasmerio/wasmer","slug":"internal-error-bad-in-progress-symbol-resolution-02cac5","errorCode":null,"errorMessage":"Internal error: bad in-progress symbol resolution","messagePattern":"Internal error: bad in-progress symbol resolution","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"lib/wasix/src/state/linker/instance_group/imports.rs","lineNumber":160,"sourceCode":"\n                        PartiallyResolvedExport::Tls { offset, final_addr } => {\n                            trace!(?module_handle, ?import, offset, final_addr, \"TLS address\");\n\n                            let global =\n                                define_integer_global_import(store, &import, final_addr).unwrap();\n\n                            imports.define(import.module(), import.name(), global);\n                            linker_state.symbol_resolution_records.insert(\n                                SymbolResolutionKey::Needed(key.clone()),\n                                SymbolResolutionResult::Tls {\n                                    resolved_from: *module_handle,\n                                    offset,\n                                },\n                            );\n                        }\n\n                        PartiallyResolvedExport::Function(_) => {\n                            panic!(\"Internal error: bad in-progress symbol resolution\")\n                        }\n                    }\n                }\n\n                InProgressSymbolResolution::UnresolvedMemGlobal => {\n                    let global = define_integer_global_import(store, &import, 0).unwrap();\n                    imports.define(import.module(), import.name(), global.clone());\n\n                    link_state\n                        .unresolved_globals\n                        .push(UnresolvedGlobal::Mem(key, global));\n                }\n\n                InProgressSymbolResolution::FuncGlobal(module_handle) => {\n                    let func = self\n                        .instance(*module_handle)\n                        .exports\n                        .get_function(import.name())","sourceCodeStart":142,"sourceCodeEnd":178,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/state/linker/instance_group/imports.rs#L142-L178","documentation":"During import population, a memory-address computation encountered a PartiallyResolvedExport::Function where only memory/global addresses are valid. A function export cannot provide a memory offset address, so reaching it means the resolver assigned the wrong export kind to the symbol — an internal invariant violation, hence a bare panic.","triggerScenarios":"populate_imports_from_link_state handling an InProgressSymbolResolution whose PartiallyResolvedExport is Function(_) while computing a memory offset — i.e. the link state recorded a function export for a symbol the importer expects to be a memory or global address.","commonSituations":"Side modules importing a memory-relative symbol (e.g. for static data) that was resolved against a function export in the exporting module; symbol-name collisions resolving to the wrong export type; hand-built LinkStates with mismatched export kinds.","solutions":["Check which symbol maps to PartiallyResolvedExport::Function and verify the exporting module actually exports a memory/global (not a function) under that name.","Fix symbol collisions/renames so the expected memory or global is exported under the imported name.","Validate export kinds in the link-state resolver before replaying them as memory addresses.","Reproduce upstream if it occurs with standard pic-linking flows and report to wasmtime with the module pair."],"exampleFix":"// before: wrong export kind recorded during resolution\nlet addr = match export { PartiallyResolvedExport::Global(addr) => addr, ... PartiallyResolvedExport::Function(_) => panic!(...) };\n// after: reject early with a typed link error\nif matches!(export, PartiallyResolvedExport::Function(_)) {\n    return Err(LinkError::ExpectedMemoryOrGlobalExport(import.name().to_string()));\n}","handlingStrategy":"type-guard","validationCode":"// Before populating, ensure memory/global imports did not resolve to function exports\nfn export_kind_ok(res: &InProgressSymbolResolution, expected: ImportKind) -> bool {\n    match (res, expected) {\n        (InProgressSymbolResolution::Resolved(PartiallyResolvedExport::Function(_)), ImportKind::Func)\n        | (InProgressSymbolResolution::Resolved(PartiallyResolvedExport::Global(_)), ImportKind::Global) => true,\n        _ => false,\n    }\n}","typeGuard":"fn is_memory_or_global(e: &PartiallyResolvedExport) -> bool {\n    !matches!(e, PartiallyResolvedExport::Function(_))\n}","tryCatchPattern":null,"preventionTips":["Check export types match import types during symbol resolution (function vs memory vs global).","Avoid symbol-name collisions that resolve a data import against a function export.","Validate export kinds in the resolver before storing them in the link state.","Keep side-module import lists consistent with what the main module exports."],"tags":["panic","dynamic-linking","symbol-resolution","wasix","internal-error"],"backgroundTag":"wrong-export-kind","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}