Stream: wasi

Topic: [Need Help] run wasm components with wasi 0.3 and wasmtime


view this post on Zulip Marcell Mészáros (Aug 09 2026 at 12:13):

Hello!

I would like to ask for some help and I hope I'm posting this in the right place.

I have this code with the following wit:

package playground:test;

world test {
    export wasi:cli/run@0.3.0-rc-2026-03-15;
}
mod bindings {
    use super::Component;

    wit_bindgen::generate!();

    export!(Component);
}

struct Component;

impl bindings::exports::wasi::cli::run::Guest for Component {
    async fn run() -> Result<(),()> {
        println!("Hello, world!");
        Ok(())
    }
}

When i try to run the generated wasm with "wasmtime run -Sp3 -Wcomponent-model-async target/wasm32-wasip2/debug/test_wasip3.wasm" command, based on the documentation.

I get an error:

Error: failed to run main module `target/wasm32-wasip2/debug/test_wasip3.wasm`

Caused by:
    no exported instance named `wasi:cli/run@0.2.12`

If i run it with this command "wasmtime run (-Sp3 -W component-model-async=y) --invoke "run()" target/wasm32-wasip2/debug/test_wasip3.wasm". It works fine. Omitting the options in brackets as well.

Am I doing something wrong or missing something?

( I am using wit-bindgen "0.60.0" with async feature and wasmtime 47.0.2 (90fed3c6a 2026-07-21). And the depencencies in the wit directory have version 0.3.0-rc-2026-03-15 as well.)

view this post on Zulip Till Schneidereit (Aug 10 2026 at 13:20):

Hi Marcell, and welcome!

I think the issue is with targeting the snapshot instead of the final version of WASIp3. The docs seem to be a bit outdated in that regard, unfortunately :frown: If you target wasi:cli/run@0.3.0, things should work.

The reason for the somewhat confusing error message is that if Wasmtime can't find a run export for either WASIp2 or WASIp3, it prints an error message only mentioning the former. I filed an issue about improving the output.

view this post on Zulip Till Schneidereit (Aug 10 2026 at 13:24):

unrelatedly, you can use the wasip3 crate for this as well, in which case you can replace mod bindings with wasip3::cli::command::export!(Component)


Last updated: Aug 30 2026 at 09:07 UTC