Skip to content

wasi:http/service p3 component generated by wit-bindgen is rejected by wasmtime serve (wasi:http/types resource mismatch) #1554

@mizchi

Description

@mizchi

Summary

Using wit-bindgen (crate 0.51.0) to generate a wasi:http/service@0.3.0-rc-2026-01-06 component produces a valid component (wasm-tools validate passes), but the generated import shape appears incompatible with wasmtime serve.

Related wasmtime issue: bytecodealliance/wasmtime#12714

Versions

  • wit-bindgen crate: 0.51.0
  • rustc: 1.92.0
  • wasm-tools: 1.245.1
  • wasmtime: 41.0.3

Repro

src/lib.rs:

wit_bindgen::generate!({
    inline: r#"
      package vibe:http-adapter;

      world serviceonly {
        include wasi:http/service@0.3.0-rc-2026-01-06;
      }
    "#,
    path: "<wasmtime repo>/crates/wasi-http/src/p3/wit",
    world: "vibe:http-adapter/serviceonly",
    pub_export_macro: true,
    generate_all,
});

use exports::wasi::http::handler::Guest;
use wasi::http::types::{ErrorCode, Request, Response};

struct Component;

impl Guest for Component {
    async fn handle(request: Request) -> Result<Response, ErrorCode> {
        let _ = request;
        Err(ErrorCode::InternalError(None))
    }
}

export!(Component);
cargo build --target wasm32-unknown-unknown --release
wasm-tools component new target/wasm32-unknown-unknown/release/<crate>.wasm -o service_only.component.wasm
wasm-tools component wit service_only.component.wasm > service_only.wit

Generated service_only.wit starts as:

package root:component;

world root {
  import wasi:http/types@0.3.0-rc-2026-01-06;

  export wasi:http/handler@0.3.0-rc-2026-01-06;
}
package wasi:http@0.3.0-rc-2026-01-06 {
  interface types {
    resource request;
    resource response;
    ...

Then wasmtime serve fails:

instance export `request` has the wrong type
resource implementation is missing

Question

Is this import/type shape expected from wit-bindgen for P3 wasi:http/service, or should wit-bindgen preserve a fuller types resource shape so hosts can link canonical wasi:http/types implementations?

If this is expected behavior, is there a recommended generation mode/flag to avoid this incompatibility?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions