bytecodealliance / bytecodealliance/wasmtime

List all supported exports in error message when failing to run a component

Open
#14,099 0 comments 0 reactions 0 assignees View on GitHub
enhancement wasmtime
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

When using `wasmtime run` with a component that doesn't export `wasi:cli/run` at a supported version, we currently print a message along the lines of
```
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`
```

Ideally, we'd instead print something like this:
```
Error: failed to run component `target/wasm32-wasip2/debug/test_wasip3.wasm`

The component doesn't export any of the supported handlers. The component must export at least one of:
an instance of the interface `wasi:cli/run@0.2`
an instance of the interface `wasi:cli/run@0.3`
```

Note the absence of a patch version: we support `0` of both, and shouldn't indicate a higher requirement than we actually have.

(Note also the change to the first line, replacing "main module" with "component" as well.)

Oh, and all of this applies to `wasmtime serve` with slight modifications as well.

Contributor guide

Open the contributing guide

Research direction

Start with the `wasmtime run` error path and compare the related `wasmtime serve` behavior. Trace how supported `wasi:cli/run` handlers are selected and how the current missing-export error is assembled. Done means both commands list all supported interface versions without patch versions and use “component” in the opening message.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, wasm
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.