{"record":{"id":"6ee463f94e80a03e","repo":"a-b-street/abstreet","slug":"failed","errorCode":null,"errorMessage":"{:?} failed","messagePattern":"(.+?) failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"abstutil/src/process.rs","lineNumber":9,"sourceCode":"use std::process::Command;\n\n/// Runs a command, asserts success. STDOUT and STDERR aren't touched.\npub fn must_run_cmd(cmd: &mut Command) {\n    println!(\"- Running {:?}\", cmd);\n    match cmd.status() {\n        Ok(status) => {\n            if !status.success() {\n                panic!(\"{:?} failed\", cmd);\n            }\n        }\n        Err(err) => {\n            panic!(\"Failed to run {:?}: {:?}\", cmd, err);\n        }\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":17,"githubUrl":"https://github.com/a-b-street/abstreet/blob/0964f29315820c91b171b585eb51e300164e9197/abstutil/src/process.rs#L1-L17","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Fix the input data / flags that made the subprocess exit non-zero (bad URL, corrupt file, wrong paths).","Check network connectivity and credentials for download/upload commands.","If failure should be tolerated, use Command::status() directly and match on the ExitStatus instead of must_run_cmd."],"exampleFix":"// before\nabstutil::must_run_cmd(&mut Command::new(\"osmium\").args(&[\"extract\", bad_input]));\n// after\nlet status = Command::new(\"osmium\").args(&[\"extract\", bad_input]).status()?;\nif !status.success() {\n    eprintln!(\"osmium failed with {:?}; continuing anyway\", status);\n}","handlingStrategy":"try-catch","validationCode":"// Cannot catch a panic; verify preconditions first:\nassert!(which::which(\"osmium\").is_ok(), \"osmium not on PATH\");","typeGuard":null,"tryCatchPattern":"// Replace with manual status handling:\nmatch cmd.status() {\n    Ok(s) if s.success() => {},\n    Ok(s) => eprintln!(\"command exited with {:?}\", s.code()),\n    Err(e) => eprintln!(\"spawn failed: {}\", e),\n}","preventionTips":["Test wrapped commands manually with identical arguments before automating.","Capture and log subprocess stdout/stderr for diagnostics.","Validate input files (URLs reachable, OSM extracts valid) before invoking osmium/download."],"tags":["panic","subprocess","command-failed","exit-status"],"backgroundTag":"command-not-found","analyzedSha":"0964f29315820c91b171b585eb51e300164e9197","analyzedAt":"2026-09-13T18:02:03.421Z","contentChangedAt":"2026-09-13T18:02:03.421Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}