wasmerio/wasmer · critical

Internal error: bad in-progress symbol resolution: {e:?}

Error message

Internal error: bad in-progress symbol resolution: {e:?}

What it means

When populating imports from link state, an InProgressSymbolResolution returned an Err variant other than the handled MissingTlsBaseExport case. Since in-progress resolutions should never carry other errors at this stage, the code panics reporting the unexpected resolution error — an internal consistency check.

Source

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

                    let export = match self.resolve_export_from(
                        store,
                        *module_handle,
                        import.name(),
                        self.instance(*module_handle),
                        linker_state.dylink_info(*module_handle),
                        linker_state.memory_base(*module_handle),
                        self.tls_base(*module_handle),
                        true,
                    ) {
                        Ok(export) => export,
                        Err(ResolveError::NoTlsBaseGlobalExport) => {
                            return Err(LinkError::MissingTlsBaseExport(
                                import.name().to_string(),
                                *module_handle,
                            ));
                        }
                        Err(e) => {
                            panic!("Internal error: bad in-progress symbol resolution: {e:?}")
                        }
                    };

                    match export {
                        PartiallyResolvedExport::Global(addr) => {
                            trace!(?module_handle, ?import, addr, "Memory address");

                            let global =
                                define_integer_global_import(store, &import, addr).unwrap();

                            imports.define(import.module(), import.name(), global);
                            linker_state.symbol_resolution_records.insert(
                                SymbolResolutionKey::Needed(key.clone()),
                                SymbolResolutionResult::Memory(addr),
                            );
                        }

                        PartiallyResolvedExport::Tls { offset, final_addr } => {

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Inspect the {e:?} in the panic to identify which resolution failed and why; fix the producer of the link state.
  2. Ensure all in-progress resolutions are fully validated (TLS base, memory, global) before calling populate_imports_from_link_state.
  3. If the resolver legitimately produces other error variants, extend the match in imports.rs to map them to LinkError instead of panicking.
  4. Regenerate the LinkState with the current wasmtime version to eliminate format skew.

Example fix

// before
Err(e) => panic!("Internal error: bad in-progress symbol resolution: {e:?}"),
// after
Err(e) => return Err(LinkError::BadSymbolResolution(
    import.name().to_string(), *module_handle, e)),
Defensive patterns

Strategy: validation

Validate before calling

// Reject any Err-shaped in-progress resolutions before populating imports
for (key, res) in &link_state.symbols {
    if matches!(res, InProgressSymbolResolution::Err(_)) {
        return Err(format!("link state contains unresolved entry for {:?}", key));
    }
}

Type guard

fn is_resolved(res: &InProgressSymbolResolution) -> bool {
    !matches!(res, InProgressSymbolResolution::Err(_))
}

Prevention

When it happens

Trigger: A link_state symbol entry for an import is in state Err(e) with an error type other than the missing-TLS-base case while populate_imports_from_link_state walks memory/global imports; typically a link_state built with unvalidated or corrupt resolution data.

Common situations: Hand-built or deserialized LinkStates; linker passes that stash intermediate errors into symbol resolutions instead of failing the link; version skew between the resolver that produced the state and the importer consuming it.

Related errors


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