linera-io/linera-protocol · error
A Wasm runtime is required to load user applications. Please
Error message
A Wasm runtime is required to load user applications. Please enable the `wasmer` or the `wasmtime` feature flags when compiling `linera-storage`.
What it means
linera-storage's load_contract dispatches on the application runtime kind. For Wasm modules it needs a Wasm engine, selected via the wasmer or wasmtime cargo features on linera-storage. If the bytecode is Wasm and neither feature is compiled in, it panics with instructions to enable one of them. This is a build-configuration error surfacing at first Wasm app load, i.e. in get_user_contract during block execution.
Source
Thrown at linera-storage/src/lib.rs:333
let contract_bytecode = self
.thread_pool()
.run_send((), move |()| async move {
compressed_contract_bytecode.decompress()
})
.await
.await??;
match application_description.module_id.vm_runtime {
VmRuntime::Wasm => {
cfg_if::cfg_if! {
if #[cfg(with_wasm_runtime)] {
let Some(wasm_runtime) = self.wasm_runtime() else {
panic!("A Wasm runtime is required to load user applications.");
};
Ok(WasmContractModule::new(contract_bytecode, wasm_runtime)
.await?
.into())
} else {
panic!(
"A Wasm runtime is required to load user applications. \
Please enable the `wasmer` or the `wasmtime` feature flags \
when compiling `linera-storage`."
);
}
}
}
VmRuntime::Evm => {
cfg_if::cfg_if! {
if #[cfg(with_revm)] {
let evm_runtime = EvmRuntime::Revm;
Ok(EvmContractModule::new(contract_bytecode, evm_runtime)?
.into())
} else {
panic!(
"An Evm runtime is required to load user applications. \
Please enable the `revm` feature flag \
when compiling `linera-storage`."View on GitHub (pinned to 6c226ddcb3)
Solutions
- Enable the wasmtime feature (or wasmer) on the linera-storage dependency in your Cargo.toml
- Use the standard linera-service build (make build / cargo build -p linera-service), which enables a Wasm runtime by default
- If you only deploy EVM applications, keep Wasm apps out of the workload and enable with_revm instead (see the sibling EVM panic)
Example fix
# before (Cargo.toml)
linera-storage = { path = "../linera-storage", default-features = false }
# after
linera-storage = { path = "../linera-storage", default-features = false, features = ["wasmtime", "wasmer"] } Defensive patterns
Strategy: validation
Validate before calling
// Compile-time guard in the binary that loads applications:
const _: () = {
#[cfg(not(any(feature = "wasmer", feature = "wasmtime")))]
compile_error!("enable the wasmer or wasmtime feature on linera-storage to load Wasm contracts");
}; Prevention
- Assert required runtime features at compile time instead of discovering the panic in production
- Mirror the linera-service feature set in downstream builds
- Run a deploy-and-execute smoke test in CI for every runtime your deployment must support
When it happens
Trigger: Calling get_user_contract/load_contract for an application whose bytecode is a Wasm module while the linera-storage crate was built without its wasmer/wasmtime features — e.g. depending on linera-storage with default-features = false, or a downstream binary enabling only with_revm.
Common situations: Custom node/indexer/service binaries assembled from Linera crates with a minimal feature set; CI builds that trim features for speed and then run integration tests deploying example Wasm apps; embedding linera-storage into another project's dependency tree where features get unified away.
Related errors
- An Evm runtime is required to load user applications. Please
- When storage is not selected, the storage-service needs to b
- Cannot apply default storage because the feature 'rocksdb' w
- Failed to deserialize instantiation argument {argument:?}
- Attempt to modify storage from a service
AI-assisted analysis of linera-io/linera-protocol@6c226ddcb3 (2026-08-22).
Data as JSON: /api/errors/5e4c47c93b589383.
Report an issue: GitHub.