Skip to content
This repository was archived by the owner on Nov 25, 2025. It is now read-only.

Add an already-called error to run for wasip3.#74

Closed
sunfishcode wants to merge 1 commit into
mainfrom
sunfishcode/main-already-called
Closed

Add an already-called error to run for wasip3.#74
sunfishcode wants to merge 1 commit into
mainfrom
sunfishcode/main-already-called

Conversation

@sunfishcode

Copy link
Copy Markdown
Member

Define a run error type and use it in the run function, to allow programs to report an error instead of trapping if their run function is called more than once.

Define a `run` error type and use it in the `run` function, to allow
programs to report an error instead of trapping if their `run` function
is called more than once.
@ricochet ricochet requested a review from rvolosatovs August 12, 2025 13:33
Comment thread wit-0.3.0-draft/run.wit
error,

/// The `run` function has already been called in the callee's instance.
already-called

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this error case would be returned only in scenarios where the caller is malfunctioning.

If the caller is the host runtime, then that means that the host has instantiated the component, called run on it once and then called it again using the same store - effectively, the guest would signal to the host that the host's implementation has a bug. Is there a way that the host can handle this error and recover in any way?

Similarly, and IMO, more rare usage of this, would be a component composition, where a component is calling run on another component. Similarly, since this is a logical error, is there any reasonable recovery mechanism the caller can use if it receives already-called?

Looking at it from another perspective, every guest toolchain would need to track this state and return this error if run is called more than once. Are we confident that every toolchain would actually do that and return this error? In other words, can callers reliably assert that if a run() has returned error::error that it is not "caller's fault"?

Overall, I am struggling to find a use case for this error case, could you perhaps provide some examples of how this could be used?

@ricochet

Copy link
Copy Markdown
Contributor

Thank you for contributing to WASI!

As part of our proposal management process, we decided to consolidate all phase 3 proposals into a single monorepo at WebAssembly/wasi to better manage the proposals that have reached phase 3.

We have completed migrating all phase 3 proposals to WebAssembly/wasi including their issues, but PRs need to be re-opened in the new repository. This is a GitHub limitation and we're sorry for the inconvenience. Please re-open this PR on WebAssembly/wasi. Thank you!

@ricochet ricochet closed this Nov 25, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants