Skip to content

improve error message when wasm binary is missing package version#204

Open
cargopete wants to merge 1 commit into
bytecodealliance:mainfrom
cargopete:fix/publish-missing-version-error-message
Open

improve error message when wasm binary is missing package version#204
cargopete wants to merge 1 commit into
bytecodealliance:mainfrom
cargopete:fix/publish-missing-version-error-message

Conversation

@cargopete
Copy link
Copy Markdown

Fixes #117.

When wkg publish encounters a Wasm binary that has no version in the embedded package metadata (because the WIT package statement was written without a @version), the previous error message was:

Error: malformed component: component package version not found

This gives no indication of what went wrong or how to fix it. The improved message explains the cause and offers two remediation paths:

Error: malformed component: component package version not found in the Wasm binary

The Wasm file was built without a version in the WIT `package` statement.
Add a version to the `package` statement in your .wit file, e.g.:

    package example:my-package@1.0.0;

Alternatively, specify the package and version explicitly with the --package flag:

    wkg publish <file> --package <namespace>:<name>@<version>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wkg failed to retrieve the version name from wasm file name

1 participant