{"record":{"id":"fbb36f14fb4fa9ea","repo":"a-b-street/abstreet","slug":"failed-to-run","errorCode":null,"errorMessage":"Failed to run {:?}: {:?}","messagePattern":"Failed to run (.+?): (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"abstutil/src/process.rs","lineNumber":13,"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":"In must_run_cmd, when cmd.status() itself returns Err (the process could not be spawned at all — executable not on PATH, permission denied, etc.), it panics with \"Failed to run {cmd:?}: {err}\". Unlike error 11, the command never executed; this is a spawn failure.","triggerScenarios":"Calling abstutil::must_run_cmd where the executable does not exist or isn't on PATH, lacks the execute bit, or the OS refuses to fork/exec the process.","commonSituations":"Tool like osmium or wget not installed on the machine; PATH not set in cron/CI environments; the binary exists but isn't executable; running in a slim container missing the dependency.","solutions":["Install the missing executable (e.g. apt install osmium-tool) or build the repo's own binary the command refers to.","Check that the executable name is on PATH: `which <cmd>`; extend PATH in CI/cron environments.","Verify the file has the execute permission bit set (chmod +x).","Use Command::spawn/status with a match on io::Error if you want a graceful fallback to a different tool."],"exampleFix":"// before\nabstutil::must_run_cmd(&mut Command::new(\"osmium\"));\n// after\nif which::which(\"osmium\").is_err() {\n    eprintln!(\"osmium not installed; skipping extract step\");\n    return;\n}\nabstutil::must_run_cmd(&mut Command::new(\"osmium\"));","handlingStrategy":"validation","validationCode":"use std::process::Command;\nlet exe = cmd.get_program().to_string_lossy();\nassert!(which::which(&*exe).is_ok(), \"executable '{}' not on PATH\", exe);","typeGuard":null,"tryCatchPattern":"// Panics uncatchably; guard the spawn yourself:\nif let Err(e) = cmd.status() {\n    eprintln!(\"could not spawn {}: {}\", cmd.get_program().to_string_lossy(), e);\n    return;\n}","preventionTips":["Install required tools (osmium-tool, wget, etc.) and verify with `which` in setup scripts.","Set PATH explicitly in CI/cron/container environments.","Ensure built helper binaries have the execute bit and match the target platform."],"tags":["panic","subprocess","spawn-failed","io-error"],"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"}