bytecodealliance / bytecodealliance/wit-bindgen

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

Open
#1,554 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1.5k
Forks
286
Avg merge
6h 32m
Merged PRs (30d)
19

Description

## 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: https://github.com/bytecodealliance/wasmtime/issues/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`:

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

world serviceonly {
include wasi:http/service@0.3.0-rc-2026-01-06;
}
"#,
path: "/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 {
let _ = request;
Err(ErrorCode::InternalError(None))
}
}

export!(Component);
```

```bash
cargo build --target wasm32-unknown-unknown --release
wasm-tools component new target/wasm32-unknown-unknown/release/.wasm -o service_only.component.wasm
wasm-tools component wit service_only.component.wasm > service_only.wit
```

Generated `service_only.wit` starts as:

```wit
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:

```text
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?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.