wasmerio/wasmer · critical

Internal error: missing symbol resolution record for '{0}'.{

Error message

Internal error: missing symbol resolution record for '{0}'.{1}

What it means

populate_imports_from_linker looks up each side-module import in linker_state.symbol_resolution_records, which the prepare/create_instance_group flow must have populated for every import. A missing record means the pre-resolution pass skipped an import — an internal invariant breach, so it panics naming the missing module.name key.

Source

Thrown at lib/wasix/src/state/linker/instance_group/imports.rs:264

                imports,
                well_known_imports,
                MemoryImportMode::DefineOnly,
            )? {
                continue;
            }

            let key = SymbolResolutionKey::Needed(NeededSymbolResolutionKey {
                module_handle,
                import_module: import.module().to_owned(),
                import_name: import.name().to_owned(),
            });

            // Finally, go through the resolution results
            let resolution = linker_state
                .symbol_resolution_records
                .get(&key)
                .unwrap_or_else(|| {
                    panic!(
                        "Internal error: missing symbol resolution record for '{0}'.{1}",
                        import.module(),
                        import.name()
                    )
                });

            trace!(?module_handle, ?import, ?resolution, "Resolution");

            match resolution {
                SymbolResolutionResult::Function { ty, resolved_from } => {
                    let func = match self.try_instance(*resolved_from) {
                        Some(instance) => {
                            trace!(
                                ?module_handle,
                                ?import,
                                ?resolved_from,
                                "Already have instance to resolve from"
                            );

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Ensure prepare_side_module_from_linker ran to completion and recorded resolutions for every import before populate_imports_from_linker is invoked.
  2. Make sure the same module instance list is used in both the resolution-record pass and the population pass.
  3. Verify import key construction (module(), name()) matches exactly between record creation and lookup.
  4. If adding custom imports/environ, register their resolution records before instantiation.

Example fix

// before: populating imports without preparing records for all imports
let group = InstanceGroup::create_instance_group(&linker, &main_module, &side_module, ...)?; // panics
// after: prepare must cover every import of the side module first
let linker_state = prepare_side_module_from_linker(&mut linker, &side_module)?;
debug_assert!(side_module.imports().all(|i| linker_state.symbol_resolution_records.contains_key(&key_for(i))));
let group = InstanceGroup::create_instance_group(&linker, &main_module, &side_module, ...)?;
Defensive patterns

Strategy: validation

Validate before calling

// Before populate_imports_from_linker, assert records cover every import
for import in side_module.imports() {
    let key = (import.module().to_owned(), import.name().to_owned()).into();
    assert!(linker_state.symbol_resolution_records.contains_key(&key),
        "no resolution record for {}::{}", import.module(), import.name());
}

Prevention

When it happens

Trigger: create_instance_group/prepare_side_module_from_linker flow where linker_state.symbol_resolution_records lacks an entry for an import of the side module — e.g. records built from a different module than the one being instantiated, records cleared between passes, or an import list computed with different module/name normalization than the resolver used.

Common situations: Custom dynamic-linking entry points in wasix; forks bypassing the prepare pass before populate_imports_from_linker; name/module normalization mismatches (e.g. environment-prefixed imports added after resolution records were built).

Related errors


AI-assisted analysis of wasmerio/wasmer@8c4b9ee9d3 (2026-09-01). Data as JSON: /api/errors/07949e47d635ef6b. Report an issue: GitHub.