Aditya-9-6 opened PR #14515 from Aditya-9-6:component-supported-exports-error to bytecodealliance:main:
Summary
Improves the error message when failing to execute a WebAssembly component that does not export the expected command or proxy interface handlers.
Closes #14099.
Details
\wasmtime run\:
- Updates the outer context in \instantiate_and_run\ to refer to \ailed to run component <target>\ when executing a component (\RunTarget::Component\), while preserving \ailed to run main module <target>\ for core modules (\RunTarget::Core\).
- When attempting to instantiate CLI command bindings in \
un_command_component\, if neither WASIp3 nor WASIp2 bindings match due to missing exports, Wasmtime reports:
\\\ ext
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\`n an instance of the interface \wasi:cli/run@0.3\`n \\\`n (If Preview 3 is disabled via \--wasi p3=n\, only \@0.2\ is listed).\wasmtime serve\:
- Updates the outer context in \ServeCommand::execute\ to format \ailed to serve component <target>\.
- In \serve_maybe_debug\, if neither WASIp3 \ServicePre\ nor WASIp2 \ProxyPre\ can be instantiated, Wasmtime reports:
\\\ ext
The component doesn't export any of the supported handlers. The component must export at least one of:
an instance of the interface \wasi:http/incoming-handler@0.2\`n an instance of the interface \wasi:http/incoming-handler@0.3\`n \\\`n (If Preview 3 is disabled via \--wasi p3=n\, only \@0.2\ is listed).Tests:
- Added \component_missing_run_exports_error\ and \component_missing_serve_exports_error\ in \ ests/all/cli_tests.rs\ asserting the formatted error outputs under default and \--wasi p3=n\ configurations.
Aditya-9-6 requested pchickey for a review on PR #14515.
Aditya-9-6 requested wasmtime-core-reviewers for a review on PR #14515.
Aditya-9-6 edited PR #14515:
Summary
Improves the error message when failing to execute a WebAssembly component that does not export the expected command or proxy interface handlers.
Closes #14099.
Details
wasmtime run:
- Updates the outer context in
instantiate_and_runto refer tofailed to run component <target>when executing a component (RunTarget::Component), while preservingfailed to run main module <target>for core modules (RunTarget::Core).- When attempting to instantiate CLI command bindings in
run_command_component, if neither WASIp3 nor WASIp2 bindings match due to missing exports, Wasmtime reports:
text 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`
(If Preview 3 is disabled via--wasi p3=n, only@0.2is listed).
wasmtime serve:
- Updates the outer context in
ServeCommand::executeto formatfailed to serve component <target>.- In
serve_maybe_debug, if neither WASIp3ServicePrenor WASIp2ProxyPrecan be instantiated, Wasmtime reports:
text The component doesn't export any of the supported handlers. The component must export at least one of: an instance of the interface `wasi:http/incoming-handler@0.2` an instance of the interface `wasi:http/incoming-handler@0.3`
(If Preview 3 is disabled via--wasi p3=n, only@0.2is listed).Tests:
- Added
component_missing_run_exports_errorandcomponent_missing_serve_exports_errorintests/all/cli_tests.rsasserting the formatted error outputs under default and--wasi p3=nconfigurations.
Aditya-9-6 updated PR #14515.
:memo: alexcrichton submitted PR review:
Thanks!
:speech_balloon: alexcrichton created PR review comment:
It's ok to ignore directives like this -- we don't test with features disabled
:speech_balloon: alexcrichton created PR review comment:
Could this perhaps use the
.with_context(|| ...)method on the return value ofCommand::new?
:speech_balloon: alexcrichton created PR review comment:
Could this use an exhaustive match instead of an
_catch-all?
Aditya-9-6 updated PR #14515.
:memo: Aditya-9-6 submitted PR review.
:speech_balloon: Aditya-9-6 created PR review comment:
Updated to use an exhaustive match on RunTarget::Core(_) and RunTarget::Component(_).
:memo: Aditya-9-6 submitted PR review.
:speech_balloon: Aditya-9-6 created PR review comment:
Updated to use .with_context(|| ...)? on Command::new here, and similarly for ProxyPre::new in serve.rs.
:memo: Aditya-9-6 submitted PR review.
:speech_balloon: Aditya-9-6 created PR review comment:
Removed the #[cfg_attr(not(feature = \component-model\), ignore)] directives and made the @0.3 assertions unconditional in both tests.
alexcrichton commented on PR #14515:
I think you'll need to resolve the merge conflicts to get CI running again here
Aditya-9-6 updated PR #14515.
:memo: alexcrichton submitted PR review.
:speech_balloon: alexcrichton created PR review comment:
Perhaps a bad merge? The second
self.servehere seems off
Last updated: Oct 11 2026 at 04:10 UTC