{"record":{"id":"5102cfe4e28988ae","repo":"wasmerio/wasmer","slug":"internal-error-unexpected-symbol-resolution-r","errorCode":null,"errorMessage":"Internal error: unexpected symbol resolution {r:?} for requested symbol {symbol}","messagePattern":"Internal error: unexpected symbol resolution (.+?) for requested symbol (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/wasix/src/state/linker/mod.rs","lineNumber":1244,"sourceCode":"                    return Ok(ResolvedExport::Function {\n                        func_ptr: *addr as u64,\n                    });\n                }\n                SymbolResolutionResult::Memory(addr) => {\n                    return Ok(ResolvedExport::Global { data_ptr: *addr });\n                }\n                SymbolResolutionResult::Tls {\n                    resolved_from,\n                    offset,\n                } => {\n                    let Some(tls_base) = group_state.tls_base(*resolved_from) else {\n                        return Err(ResolveError::NoTlsBaseGlobalExport);\n                    };\n                    return Ok(ResolvedExport::Global {\n                        data_ptr: tls_base + offset,\n                    });\n                }\n                r => panic!(\n                    \"Internal error: unexpected symbol resolution \\\n                        {r:?} for requested symbol {symbol}\"\n                ),\n            }\n        }\n\n        let (topology_token, mut linker_state) = self\n            .shared\n            .write_linker_state_with_topology(group_state, ctx)?;\n\n        let mut store = ctx.as_store_mut();\n\n        trace!(\"Resolving export\");\n        let (export, resolved_from) =\n            group_state.resolve_export(&linker_state, &mut store, module_handle, symbol, false)?;\n\n        trace!(?export, ?resolved_from, \"Resolved export\");\n","sourceCodeStart":1226,"sourceCodeEnd":1262,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/wasix/src/state/linker/mod.rs#L1226-L1262","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check what kind of export the requested symbol actually is; only request symbols the current resolution path supports (functions/globals)","Regenerate LinkerState with the same version of the library that performs resolution - avoid serialized/stale resolution caches across versions","Route table/memory symbol resolutions through the appropriate link path instead of resolve_export","Capture the resolution variant {r:?} and symbol name from the panic and file a linker bug if it occurs with consistent versions"],"exampleFix":"// before: requesting a table-typed symbol through the export-resolution path\nlet export = linker.resolve_export(store, \"env\", \"my_table\")?; // panics on Table resolution\n// after: only resolve function/global symbols here; handle tables via the module's own exports\nlet table = instance.exports.get_table(\"my_table\")?;","handlingStrategy":"type-guard","validationCode":"fn resolvable_kind(r: &Resolution) -> bool {\n    matches!(r, Resolution::Function(_) | Resolution::Global(_) | Resolution::TlsBase(_))\n}\n// before resolving: if !resolvable_kind(res) { route symbol elsewhere }","typeGuard":"fn is_resolvable_export(r: &Resolution) -> bool {\n    matches!(r, Resolution::Function(_) | Resolution::Global(_) | Resolution::TlsBase(_))\n}","tryCatchPattern":null,"preventionTips":["Only request function/global symbols through resolve_export; fetch tables/memories from module exports","Keep LinkerState producer and resolver on the same library version","Avoid persisting/sharing resolution caches across versions","File a bug with the resolution variant if it fires with consistent versions"],"tags":["linker","symbol-resolution","internal-invariant","panic"],"backgroundTag":"linker-symbol-resolution-mismatch","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}