Skip to content

bug(cli): --max-weight threshold error prints twice #148

@rocketman-code

Description

@rocketman-code

Current Behavior

When --max-weight threshold is exceeded, the error message is printed twice: once from the explicit eprintln! + process::exit(1) in run_trace, and again from the main() error handler which catches the non-zero exit.

Expected Behavior

The error should be printed exactly once.

Context

Duplicate error messages are confusing and look like a bug to users.

Technical Details

Relevant Code

src/main.rs:365-384run_trace

if let Some(threshold) = args.max_weight.filter(|&t| report.static_weight_bytes > t) {
    eprintln!("error: ... exceeds --max-weight threshold ...");
    std::process::exit(1);
}

The process::exit(1) bypasses the normal return path. However, since run_trace returns Result<(), Error>, it should return an Err variant instead, letting the main() error handler print once and exit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low prioritybugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions