Skip to content

cargo stylus new panics when stylus-sdk is not discoverable #3003

@tusharpamnani

Description

@tusharpamnani

Description

While trying to create a new Stylus project using cargo stylus new, the command panics if the stylus-sdk package cannot be located, without providing a user-facing error message or guidance on how to resolve the issue.

Since this is typically the first command a new developer runs, the panic makes it difficult to understand what prerequisite is missing or how to proceed.


Steps to Reproduce

  1. Ensure cargo-stylus is installed

  2. Run:

    cargo stylus new example
  3. Observe the panic during project creation


Observed Behavior

The command panics with the following error:

thread 'main' panicked at ... stylus_sdk.rs:51:10:
Finding stylus-sdk package

No actionable information is provided about:

  • where stylus-sdk is expected to be found
  • whether it is missing, misconfigured, or version-incompatible
  • how the user should resolve the issue

Expected Behavior

Instead of panicking, the tool could:

  • surface a clear error message indicating that stylus-sdk is missing or not discoverable
  • document the requirement explicitly before project creation
  • or provide guidance on how to install or configure the dependency

Environment

  • OS: Windows (via WSL2 / Ubuntu)
  • Rust version: 1.92.0
  • cargo-stylus version: 0.10.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions