wasmerio/wasmer · critical
Internal error: missing import resolution '{0}'.{1}
Error message
Internal error: missing import resolution '{0}'.{1} What it means
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.
Source
Thrown at lib/wasix/src/state/linker/instance_group/imports.rs:66
module_handle,
store,
&import,
imports,
well_known_imports,
MemoryImportMode::GrowToMinimum,
)? {
continue;
}
let key = NeededSymbolResolutionKey {
module_handle,
import_module: import.module().to_owned(),
import_name: import.name().to_owned(),
};
// Finally, go through the resolution results
let resolution = link_state.symbols.get(&key).unwrap_or_else(|| {
panic!(
"Internal error: missing import resolution '{0}'.{1}",
key.import_module, key.import_name
)
});
trace!(?module_handle, ?import, ?resolution, "Resolution");
match resolution {
InProgressSymbolResolution::Function(module_handle) => {
let func = self
.instance(*module_handle)
.exports
.get_function(import.name())
.expect("Internal error: bad in-progress symbol resolution");
imports.define(import.module(), import.name(), func.clone());
linker_state.symbol_resolution_records.insert(
SymbolResolutionKey::Needed(key.clone()),
SymbolResolutionResult::Function {View on GitHub (pinned to 8c4b9ee9d3)
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.
Example fix
// before: building link state without resolving all imports let link_state = LinkState::new(); // only some imports resolved... InstanceGroup::instantiate_side_module_from_link_state(&link_state, ...); // panics // after let link_state = build_and_resolve_link_state(&side_module, &main_instance)?; // resolves ALL imports assert_imports_all_resolved(&link_state, &side_module)?; // validate before instantiate
Defensive patterns
Strategy: validation
Validate before calling
// Before instantiating, assert every side-module import has a resolution record
fn imports_all_resolved(link_state: &LinkState, module: &Module) -> Result<(), String> {
for import in module.imports() {
let key = (import.module().to_owned(), import.name().to_owned());
if !link_state.symbols.contains_key(&key.into()) {
return Err(format!("unresolved import {}::{}", import.module(), import.name()));
}
}
Ok(())
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Internal error: bad in-progress symbol resolution: {e:?}
- Internal error: failed to resolve exported function {}: {e:?
- Internal error: Tried to import TLS symbol from module {} th
- Internal error: bad in-progress symbol resolution
- Internal error: missing symbol resolution record for '{0}'.{
AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01).
Data as JSON: /api/errors/c2005af59e25709a.
Report an issue: GitHub.