{"record":{"id":"043e1e49ccb20a2c","repo":"jdx/mise","slug":"repos-command-failed-in","errorCode":null,"errorMessage":"repos: command failed in {}","messagePattern":"repos: command failed in (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/system/repos.rs","lineNumber":260,"sourceCode":"            \"$ (cd {} && {})\",\n            status.request,\n            shell_words::join(command)\n        );\n        let result = Command::new(program)\n            .args(args)\n            .current_dir(&status.request.path)\n            .status();\n        let failed = match result {\n            Ok(exit) => !exit.success(),\n            Err(err) => {\n                warn!(\"repos: {}: command failed to start: {err}\", status.request);\n                true\n            }\n        };\n        if failed {\n            failures.push(status.request.to_string());\n            if !continue_on_error {\n                bail!(\"repos: command failed in {}\", status.request);\n            }\n        }\n    }\n    if !failures.is_empty() {\n        bail!(\"repos: command failed in {}\", failures.join(\", \"));\n    }\n    Ok(())\n}\n\nfn status_one(request: &RepoRequest) -> Result<RepoStatus> {\n    if !request.path.exists() {\n        return Ok(missing_status(request));\n    }\n    if !request.path.is_dir() {\n        return Ok(conflict_status(\n            request,\n            \"path exists and is not a directory\".to_string(),\n        ));","sourceCodeStart":242,"sourceCodeEnd":278,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/repos.rs#L242-L278","documentation":"exec runs the command with each repo as working directory; a non-zero exit status — or a spawn failure such as program-not-found, which is warned as `command failed to start` and counted as failed — marks that repo failed. Without continue-on-error, exec bails on the first failure, naming that single repo and skipping all remaining repos.","triggerScenarios":"The command exits non-zero in one repo (failing test, `grep` with no match, broken build); the program name does not exist on PATH, producing the `command failed to start` warning followed by this bail.","commonSituations":"Running `git pull` or test suites across many checkouts where one repo is broken; commands whose exit-code semantics (`grep`, `diff`) surprise in a loop context; PATH differences between interactive shell and bootstrap environment.","solutions":["Reproduce manually: `cd <named repo> && <command>` to see the real exit status and output","Fix the command or the repo state that makes it fail","Enable the continue-on-error flag to run all repos and get the aggregated failure list instead of stopping at the first"],"exampleFix":"# before: stops at first failing repo\n$ mise bootstrap repos exec -- git pull   # bail: repos: command failed in ~/src/x\n\n# after: run all, report all failures\n$ mise bootstrap repos exec --continue-on-error -- git pull","handlingStrategy":"try-catch","validationCode":"fn command_runs_in_dir(program: &str, args: &[String], dir: &Path) -> bool {\n    std::process::Command::new(program)\n        .args(args)\n        .current_dir(dir)\n        .status()\n        .map(|s| s.success())\n        .unwrap_or(false)\n}\n// smoke-test the command in one repo before running exec over all of them","typeGuard":null,"tryCatchPattern":"match repos::exec(&requests, &command, dry_run, /* continue_on_error */ true) {\n    Ok(()) => {}\n    Err(report) => {\n        let msg = format!(\"{report:#}\");\n        if let Some(list) = msg.strip_prefix(\"repos: command failed in \") {\n            let failed_repos: Vec<&str> = list.split(\", \").collect();\n            // handle each failed repo; other repos already ran\n        }\n    }\n}","preventionTips":["Test the command manually in each repo (or a sample) before batch-running it","Use the continue-on-error flag to get all failures in one pass instead of fixing them one at a time","Remember a missing program counts as a failure too — verify it exists on PATH in the bootstrap environment"],"tags":["mise","bootstrap","repos","exec","exit-code"],"backgroundTag":"subcommand-nonzero-exit","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}