From 77683b3c820c179de84a6addb8f46005d5d78057 Mon Sep 17 00:00:00 2001 From: neriumpete Date: Tue, 19 May 2026 12:20:07 +0300 Subject: [PATCH] improve error message when wasm binary is missing package version --- crates/wasm-pkg-client/src/lib.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/wasm-pkg-client/src/lib.rs b/crates/wasm-pkg-client/src/lib.rs index 7621e86..99e6884 100644 --- a/crates/wasm-pkg-client/src/lib.rs +++ b/crates/wasm-pkg-client/src/lib.rs @@ -338,7 +338,18 @@ fn resolve_package( })?; let version = version.ok_or_else(|| { - crate::Error::InvalidComponent(anyhow::anyhow!("component package version not found")) + crate::Error::InvalidComponent(anyhow::anyhow!( + "component package version not found in the Wasm binary\n\ + \n\ + The Wasm file was built without a version in the WIT `package` statement.\n\ + Add a version to the `package` statement in your .wit file, e.g.:\n\ + \n\ + \tpackage example:my-package@1.0.0;\n\ + \n\ + Alternatively, specify the package and version explicitly with the --package flag:\n\ + \n\ + \twkg publish --package :@" + )) })?; Ok((data.into_inner(), package, version)) }