Skip to content

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

Description

@tschneidereit

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementwasmtimeIssues about wasmtime that don't fall into another label

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions