{"record":{"id":"cf6754aef070fa64","repo":"wasmerio/wasmer","slug":"the-val-is-not-yet-supported","errorCode":null,"errorMessage":"The {val:?} is not yet supported","messagePattern":"The (.+?) is not yet supported","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/api/src/backend/js/entities/table.rs","lineNumber":39,"sourceCode":"        .set_raw(item_index, item)\n        .map_err(|e| e.into())\n}\n\nfn get_table_item(store: &mut impl AsStoreMut, val: Value) -> Result<JsValue, RuntimeError> {\n    if !val.is_from_store(store) {\n        return Err(RuntimeError::new(\"cannot pass Value across contexts\"));\n    }\n    match val {\n        Value::FuncRef(Some(ref func)) => Ok(func.as_js().handle.function.clone().into_inner().into()),\n        Value::FuncRef(None) | Value::ExternRef(None) => Ok(JsValue::null()),\n        Value::ExternRef(Some(ref reference)) => match &reference.0 {\n            crate::BackendExternRef::Js(reference) => Ok(reference.as_js_value()),\n            #[allow(unreachable_patterns)]\n            _ => Err(RuntimeError::new(\n                \"cannot pass an externref across backends\",\n            )),\n        },\n        _ => unimplemented!(\"The {val:?} is not yet supported\"),\n    }\n}\n\nimpl Table {\n    pub fn new(\n        store: &mut impl AsStoreMut,\n        ty: TableType,\n        init: Value,\n    ) -> Result<Self, RuntimeError> {\n        let mut store = store;\n        let descriptor = js_sys::Object::new();\n        js_sys::Reflect::set(&descriptor, &\"initial\".into(), &ty.minimum.into())?;\n        if let Some(max) = ty.maximum {\n            js_sys::Reflect::set(&descriptor, &\"maximum\".into(), &max.into())?;\n        }\n        let element = match ty.ty {\n            Type::FuncRef => \"anyfunc\",\n            Type::ExternRef => \"externref\",","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/api/src/backend/js/entities/table.rs#L21-L57","documentation":"`get_table_item` on the JS backend converts the stored table element back into a wasmer Value. Only externref-backed JS references are implemented; any other element representation (e.g. funcref or a non-JS backend externref) hits the `unimplemented!` arm and panics.","triggerScenarios":"Calling `Table::get`/`set`/`grow` (via `new`/`set`/`grow` -> `get_table_item`) on a JS-backend table whose element type or stored value is not a JS-backed externref — e.g. funcref tables or externrefs created by a non-JS backend.","commonSituations":"Cross-backend code moving tables/externrefs between sys and js runtimes; creating tables with `TableType` element types other than externref and then reading items from the browser build.","solutions":["Only read items from JS-backend tables with element type `externref` holding JS-originated values","Handle funcref tables through `Function::new`/JS function wrappers instead of raw `get`","Gate table item access behind a backend check and provide a stub for unsupported element types"],"exampleFix":"// before\nlet val = table.get(&mut store, index)?; // funcref table\n// after\nif table.ty(&store).element != Type::ExternRef {\n    return Err(RuntimeError::new(\"unsupported table element type on js backend\"));\n}\nlet val = table.get(&mut store, index)?;","handlingStrategy":"validation","validationCode":"fn table_items_supported(table: &Table, store: &impl AsStoreRef) -> bool {\n    table.ty(store).element == Type::ExternRef\n}","typeGuard":null,"tryCatchPattern":"// stub panics, not Result: check element type before get/set/grow\nif !table_items_supported(&table, &store) {\n    return Err(anyhow!(\"js backend only supports externref table items\"));\n}","preventionTips":["Check TableType element type before item access on the js backend","Use externref-only tables in browser builds","Test cross-backend code paths on the js target in CI"],"tags":["wasm","javascript-backend","funcref","externref","unimplemented"],"backgroundTag":"unimplemented-js-backend-feature","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}