Skip to content

fix: wasmer-cli - panic when command name shadows dependency entry#6563

Merged
Arshia001 merged 3 commits intowasmerio:mainfrom
Fliqqr:fix-command-shadow-panic
May 6, 2026
Merged

fix: wasmer-cli - panic when command name shadows dependency entry#6563
Arshia001 merged 3 commits intowasmerio:mainfrom
Fliqqr:fix-command-shadow-panic

Conversation

@Fliqqr
Copy link
Copy Markdown
Contributor

@Fliqqr Fliqqr commented May 5, 2026

Description

When a package defines a command whose name matches a command exposed by one of its dependencies, Wasmer can resolve the root command correctly but fail later while loading the package tree. In that case, the dependency package may not be fetched even though the root command’s atom annotation points into that dependency, causing the CLI to panic with a missing map entry instead of returning a normal error.

Reproduce with:

[package]
…
entrypoint = "webserver"

[dependencies]
"wasmer/static-web-server" = "^1"

[[command]]
name = "webserver"
module = "wasmer/static-web-server:webserver"
runner = "https://webc.org/runner/wasi"

Run:
wasmer run .

Changes

  • Updated load_binary_command to return user friendly error when command resolving fails due to shadowing

  • Replaced unchecked map indexing with contextual errors to avoid panics

  • Added a regression test for the dependency command shadowing

  • Re-enabled and updated the existing resolver test for shadowing

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR addresses a wasmer run failure mode in WASIX package loading where a root command can shadow a dependency command name, yet still point at the dependency’s atom. The change updates package-tree loading and tests so shadowed dependency-backed commands are handled as errors instead of panicking.

Changes:

  • Replaced unchecked package/command map indexing in package loading with contextual get(...).with_context(...) error paths.
  • Added packages_needed_for_load() and updated dependency fetching so command owners’ direct dependencies are considered during load.
  • Re-enabled the resolver shadowing test and added a regression-oriented package-loader test for the shadowed-command scenario.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
lib/wasix/src/runtime/resolver/resolve.rs Re-enables and updates the resolver test for root-command shadowing behavior, including entrypoint expectations.
lib/wasix/src/runtime/package_loader/load_package_tree.rs Changes dependency selection and command loading error handling, and adds a regression test around shadowed dependency commands.

Comment thread lib/wasix/src/runtime/package_loader/load_package_tree.rs Outdated
Comment thread lib/wasix/src/runtime/package_loader/load_package_tree.rs Outdated
Copy link
Copy Markdown
Member

@Arshia001 Arshia001 left a comment

Choose a reason for hiding this comment

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

I'll hold out on reviewing this until the comments from Copilot receive responses, since I find them valid but I'm not immediately super-familiar with this part of the code so I may be wrong.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@Arshia001 Arshia001 merged commit 2d7e677 into wasmerio:main May 6, 2026
76 checks passed
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.

3 participants