wasmtime "unknown import" / import not found at instantiation in CI
A wasm module lists the imports it needs (functions, memory, globals). At instantiation the host must supply every one. wasmtime fails with "unknown import" when the module asks for something the embedder did not define.
What this error means
Instantiation fails with "unknown import: env::log has not been defined" or "import ... not found", naming a function the host did not provide.
error: failed to instantiate "app.wasm"
Caused by:
unknown import: `env::log` has not been definedCommon causes
The host did not provide a declared import
The module imports a function from a namespace (often env) that the embedding code or CLI never defines, so linking the imports fails.
A name or module mismatch in the import
The host defines an import under a different module or field name than the module expects, so the lookup misses.
How to fix it
Define every import the module declares
- List the module imports to see exactly what it needs.
- Provide each one in the host with the exact module and field name.
- Re-instantiate.
wasmtime explore app.wasm # or: wasm-objdump -j Import -x app.wasmMatch the import namespace and name
Ensure the host links the function under the same module/field the wasm declares, since env::log and host::log are different imports.
How to prevent it
- Inspect a module's imports and provide each before instantiation.
- Keep host-provided import names identical to what the module declares.
- Validate instantiation in CI so missing imports fail before deploy.