wasmerio/wasmer · error

Internal error: unexpected symbol resolution {r:?} for reque

Error message

Internal error: unexpected symbol resolution {r:?} for requested symbol {symbol}

What it means

resolve_export matches a symbol resolution from LinkerState to a ResolvedExport variant (function, global, TLS base, etc.). If the stored resolution variant does not correspond to any known export kind for the requested symbol, it panics. This means the resolution record's variant set and resolve_export's matcher have diverged - typically a new/unknown resolution kind or corrupted state.

Source

Thrown at lib/wasix/src/state/linker/mod.rs:1244

                    return Ok(ResolvedExport::Function {
                        func_ptr: *addr as u64,
                    });
                }
                SymbolResolutionResult::Memory(addr) => {
                    return Ok(ResolvedExport::Global { data_ptr: *addr });
                }
                SymbolResolutionResult::Tls {
                    resolved_from,
                    offset,
                } => {
                    let Some(tls_base) = group_state.tls_base(*resolved_from) else {
                        return Err(ResolveError::NoTlsBaseGlobalExport);
                    };
                    return Ok(ResolvedExport::Global {
                        data_ptr: tls_base + offset,
                    });
                }
                r => panic!(
                    "Internal error: unexpected symbol resolution \
                        {r:?} for requested symbol {symbol}"
                ),
            }
        }

        let (topology_token, mut linker_state) = self
            .shared
            .write_linker_state_with_topology(group_state, ctx)?;

        let mut store = ctx.as_store_mut();

        trace!("Resolving export");
        let (export, resolved_from) =
            group_state.resolve_export(&linker_state, &mut store, module_handle, symbol, false)?;

        trace!(?export, ?resolved_from, "Resolved export");

View on GitHub (pinned to 8c4b9ee9d3)

Solutions

  1. Check what kind of export the requested symbol actually is; only request symbols the current resolution path supports (functions/globals)
  2. Regenerate LinkerState with the same version of the library that performs resolution - avoid serialized/stale resolution caches across versions
  3. Route table/memory symbol resolutions through the appropriate link path instead of resolve_export
  4. Capture the resolution variant {r:?} and symbol name from the panic and file a linker bug if it occurs with consistent versions

Example fix

// before: requesting a table-typed symbol through the export-resolution path
let export = linker.resolve_export(store, "env", "my_table")?; // panics on Table resolution
// after: only resolve function/global symbols here; handle tables via the module's own exports
let table = instance.exports.get_table("my_table")?;
Defensive patterns

Strategy: type-guard

Validate before calling

fn resolvable_kind(r: &Resolution) -> bool {
    matches!(r, Resolution::Function(_) | Resolution::Global(_) | Resolution::TlsBase(_))
}
// before resolving: if !resolvable_kind(res) { route symbol elsewhere }

Type guard

fn is_resolvable_export(r: &Resolution) -> bool {
    matches!(r, Resolution::Function(_) | Resolution::Global(_) | Resolution::TlsBase(_))
}

Prevention

When it happens

Trigger: resolve_export (via apply_requested_symbols_from_linker / symbol resolution flows) encountering a resolution variant r not covered by the match arms, e.g. a Table or Memory resolution where the code path only expects Function/Global/TlsBase; state recorded by a newer linker version than the resolver.

Common situations: Requesting a symbol whose resolution is a table/memory from a path that cannot serve it; mixed-version linker state or shared resolution caches; internal linker bug adding a resolution kind without updating resolve_export.

Related errors


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