{"record":{"id":"bdd9fa1689afd105","repo":"wasmerio/wasmer","slug":"unsupported-wasm-c-api-import-version-version","errorCode":null,"errorMessage":"unsupported Wasm C API import version: {version:?}","messagePattern":"unsupported Wasm C API import version: (.+?)","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"lib/c-api-imports/src/lib.rs","lineNumber":131,"sourceCode":"\n        Self {\n            version: module_wasm_c_api_version_used(module),\n            imported_memory_type,\n            imported_table_type,\n            resolve_module_sync,\n            func_env: None,\n        }\n    }\n\n    fn needs_imports(&self) -> bool {\n        self.version.is_some()\n    }\n\n    fn validate_supported(&self) -> Result<()> {\n        if let Some(version) = self.version\n            && !WasmCAPIVersion::V0.is_compatible_with(version)\n        {\n            bail!(\"unsupported Wasm C API import version: {version:?}\");\n        }\n        Ok(())\n    }\n\n    fn register_imports(&mut self, store: &mut StoreMut<'_>, io: &mut Imports) -> Result<()> {\n        self.validate_supported()?;\n        if self.version.is_none() {\n            return Ok(());\n        }\n\n        let func_env = FunctionEnv::new(\n            &mut *store,\n            WasmCapiEnv {\n                resolve_module_sync: self.resolve_module_sync.clone(),\n                ..WasmCapiEnv::default()\n            },\n        );\n        self.func_env = Some(func_env.clone());","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/wasmerio/wasmer/blob/8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5/lib/c-api-imports/src/lib.rs#L113-L149","documentation":"Wasmer's Wasm C API imports layer only supports version V0 of the Wasm C API. When a module (or embedder) declares a C API import version that is not compatible with V0, validate_supported bails with this error before any imports are registered. It is a forward-compatibility guard against newer/unknown C API versions.","triggerScenarios":"Calling add_imports/register_imports on a WasmCApiImports instance whose `version` field is set to Some(v) where WasmCAPIVersion::V0.is_compatible_with(v) is false (e.g. a newer C API version enum value).","commonSituations":"Using a wasm-c-api header/SDK newer than the Wasmer build; embedding Wasmer behind a C API shim built against a different spec revision; misconfigured import builder passing an explicit version.","solutions":["Set the C API import version to V0 (or leave it as None to use the default)","Rebuild/upgrade the embedding code so both sides agree on the V0 C API revision","Upgrade Wasmer to a release that supports the requested C API version, if one exists"],"exampleFix":"// before\nlet imports = WasmCApiImports::default().version(WasmCAPIVersion::V2);\n// after\nlet imports = WasmCApiImports::default().version(WasmCAPIVersion::V0);","handlingStrategy":"validation","validationCode":"if let Some(v) = imports.version() {\n    if !wasm_c_api_imports::WasmCAPIVersion::V0.is_compatible_with(v) {\n        return Err(format!(\"unsupported C API version {v:?}; use V0\"));\n    }\n}","typeGuard":"fn is_supported_version(v: Option<WasmCAPIVersion>) -> bool {\n    v.map_or(true, |v| WasmCAPIVersion::V0.is_compatible_with(v))\n}","tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"unsupported Wasm C API import version\") => retry_with_v0(),\n    other => other?,\n}","preventionTips":["Always construct WasmCApiImports with version V0 or None","Keep the wasm-c-api SDK headers in sync with the Wasmer version","Pin Wasmer versions in your embedding to avoid silent C API revision bumps"],"tags":["wasm","c-api","version-compat","imports"],"backgroundTag":"unsupported-c-api-version","analyzedSha":"8c4b9ee9d33fb2068863fbb3d328683e7e6ff7f5","analyzedAt":"2026-09-01T23:06:31.009Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}