{"record":{"id":"c2005af59e25709a","repo":"wasmerio/wasmer","slug":"internal-error-missing-import-resolution-0-1","errorCode":null,"errorMessage":"Internal error: missing import resolution '{0}'.{1}","messagePattern":"Internal error: missing import resolution '(.+?)'\\.(.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"lib/wasix/src/state/linker/instance_group/imports.rs","lineNumber":66,"sourceCode":"                module_handle,\n                store,\n                &import,\n                imports,\n                well_known_imports,\n                MemoryImportMode::GrowToMinimum,\n            )? {\n                continue;\n            }\n\n            let key = NeededSymbolResolutionKey {\n                module_handle,\n                import_module: import.module().to_owned(),\n                import_name: import.name().to_owned(),\n            };\n\n            // Finally, go through the resolution results\n            let resolution = link_state.symbols.get(&key).unwrap_or_else(|| {\n                panic!(\n                    \"Internal error: missing import resolution '{0}'.{1}\",\n                    key.import_module, key.import_name\n                )\n            });\n\n            trace!(?module_handle, ?import, ?resolution, \"Resolution\");\n\n            match resolution {\n                InProgressSymbolResolution::Function(module_handle) => {\n                    let func = self\n                        .instance(*module_handle)\n                        .exports\n                        .get_function(import.name())\n                        .expect(\"Internal error: bad in-progress symbol resolution\");\n                    imports.define(import.module(), import.name(), func.clone());\n                    linker_state.symbol_resolution_records.insert(\n                        SymbolResolutionKey::Needed(key.clone()),\n                        SymbolResolutionResult::Function {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/state/linker/instance_group/imports.rs#L48-L84","documentation":"populate_imports_from_link_state replays import resolutions already recorded in link_state.symbols; every import of the side module must have an entry. A missing entry means the link-state builder and the import-apply pass disagree — an internal invariant breach, so it panics with the module.name key that lacked a resolution.","triggerScenarios":"Instantiating a side module from a LinkState whose `symbols` map lacks an entry for some import (module, name) — e.g. link state built by a different code path/older API, symbols map cleared or keyed differently before populate_imports_from_link_state runs, or new/instance_side_module receiving a hand-constructed LinkState.","commonSituations":"Custom wasix dlopen/dlsym implementations constructing LinkState manually; mixing wasmtime versions where the LinkState key format changed; partial linking where some imports were never resolved before instantiation is attempted.","solutions":["Ensure the LinkState passed to instantiate_side_module_from_link_state has completed symbol resolution for every import of the side module (check resolve errors surfaced earlier).","Do not clear or mutate link_state.symbols between resolution and import population.","Rebuild against the same wasmtime version used to produce the LinkState (key format compatibility).","Log the missing key (shown in the panic) and verify that import was part of the original resolve pass."],"exampleFix":"// before: building link state without resolving all imports\nlet link_state = LinkState::new();\n// only some imports resolved...\nInstanceGroup::instantiate_side_module_from_link_state(&link_state, ...); // panics\n// after\nlet link_state = build_and_resolve_link_state(&side_module, &main_instance)?; // resolves ALL imports\nassert_imports_all_resolved(&link_state, &side_module)?; // validate before instantiate","handlingStrategy":"validation","validationCode":"// Before instantiating, assert every side-module import has a resolution record\nfn imports_all_resolved(link_state: &LinkState, module: &Module) -> Result<(), String> {\n    for import in module.imports() {\n        let key = (import.module().to_owned(), import.name().to_owned());\n        if !link_state.symbols.contains_key(&key.into()) {\n            return Err(format!(\"unresolved import {}::{}\", import.module(), import.name()));\n        }\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Complete the full symbol-resolution pass before calling instantiate_side_module_from_link_state.","Never construct LinkState manually or clear its symbols map between passes.","Build and consume the LinkState with the same wasmtime version.","Assert link_state.symbols covers all module imports in debug builds."],"tags":["panic","dynamic-linking","link-state","wasix","internal-error"],"backgroundTag":"missing-symbol-resolution","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}