After a long break I got back to some of my WASM related projects and I'm trying to update from Wasmtime 25 to 41. I was able to make the code compile after updating some of the APIs that changed, here is a diff. The problem is that when I call a function from the host I get the following error:
Error running WASM: error while executing at wasm backtrace:
0: 0xd8e0 - wit-component:shim!indirect-host-http-request
1: 0x868 - wasm_example.wasm!run-scenario
Caused by:
pointer not aligned
I think that the problems might be related to the interface between the guest and the host, or more precisely on how the response from the function is serialised. I tried to isolate the failure and checked what happens when the exported function doesn't call any host functions - it works fine. So then I changed the host function to not return anything, that also works fine. Which seems to indicate that the problem occurs only when I return any actual data from the host to the guest.
Some more info about the current implementation:
http-request)Memory creation, but I'm not 100% sure if I should replace it with something elsedefault: async entries for imports and exports cause otherwise the build was broken, but the guest side is supposed to be sync, only the host should be async. I'm guessing the async part for exports is just for calling from the async runtime on the Rust side, but again, not sureI'm not really sure how to debug this cause the code seems to be doing roughly a similar thing to what examples are doing, although I haven't seen any recent examples of an async host interface with custom world, only async implementations from wasmtime. Any ideas on how could I debug further or which part of my setup seem problematic?
You're using a pretty old toolchain in rust-toolchain.toml, although that toolchain also shouldn't be able to build wasmtime given its age. So your local configuration might be ignoring that file as well (I ran into that poking at this locally though). I also see you're using a pretty old version of wit-bindgen in the guest (0.33 vs 0.51 is current)
I might recommend updating some of these related deps first and seeing if that helps? It might be that bugs were fixed there in the meantime
If that doesn't end up fixing it, if you're able to reduce this to a cargo run-able thing to reproduce I can try to help poke a bit more too
OMG, that was indeed wit-bindgen version! Thanks so much for taking a look. I updated most of the stuff in the main Cargo.toml, but I totally forgot that wit-bindgen is also used in the guest project. Regarding the toolchain I was using an override, sorry for the confusion, but yeah, it runs on 1.92 and the newest wasmtime/wit-bindgen combo without any issues.
Last updated: Feb 24 2026 at 04:36 UTC