a-b-street/abstreet · error

failed

Error message

{:?} failed

What it means

must_run_cmd runs an external command and asserts it exits successfully. If cmd.status() returns Ok but the exit status indicates failure (non-zero exit code or signal), it panics with "{cmd:?} failed". It is the strict wrapper used by download, osmium, upload, and incremental_upload to abort import/deploy pipelines when a subprocess fails.

Solutions

  1. Run the wrapped command manually with the same arguments to see its real error output (must_run_cmd doesn't capture stdout/stderr, so the subprocess's own message was printed).
  2. Fix the input data / flags that made the subprocess exit non-zero (bad URL, corrupt file, wrong paths).
  3. Check network connectivity and credentials for download/upload commands.
  4. If failure should be tolerated, use Command::status() directly and match on the ExitStatus instead of must_run_cmd.

Example fix

// before
abstutil::must_run_cmd(&mut Command::new("osmium").args(&["extract", bad_input]));
// after
let status = Command::new("osmium").args(&["extract", bad_input]).status()?;
if !status.success() {
    eprintln!("osmium failed with {:?}; continuing anyway", status);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Cannot catch a panic; verify preconditions first:
assert!(which::which("osmium").is_ok(), "osmium not on PATH");

Try / catch

// Replace with manual status handling:
match cmd.status() {
    Ok(s) if s.success() => {},
    Ok(s) => eprintln!("command exited with {:?}", s.code()),
    Err(e) => eprintln!("spawn failed: {}", e),
}

Prevention

When it happens

Trigger: Calling abstutil::must_run_cmd with a command that runs but exits non-zero — e.g. a download tool failing, osmium rejecting a bad OSM extract, git/upload commands failing due to remote errors.

Common situations: OSM data URL changed so wget/curl fails; osmium invoked on corrupt/unsupported PBF input; upload target rejects credentials; missing network causing any subprocess to fail; wrong CLI flags passed to the wrapped tool.

Related errors


AI-assisted analysis of a-b-street/abstreet@0964f29315 (2026-09-13). Data as JSON: /api/errors/6ee463f94e80a03e. Report an issue: GitHub.

Appendix: source

Thrown at abstutil/src/process.rs:9

use std::process::Command;

/// Runs a command, asserts success. STDOUT and STDERR aren't touched.
pub fn must_run_cmd(cmd: &mut Command) {
    println!("- Running {:?}", cmd);
    match cmd.status() {
        Ok(status) => {
            if !status.success() {
                panic!("{:?} failed", cmd);
            }
        }
        Err(err) => {
            panic!("Failed to run {:?}: {:?}", cmd, err);
        }
    }
}

View on GitHub (pinned to 0964f29315)