{"record":{"id":"0ba7fa81a6e29ab8","repo":"jdx/mise","slug":"compose-command-failed-with-status","errorCode":null,"errorMessage":"compose command failed with {status}","messagePattern":"compose command failed with (.+?)","errorType":"exception","errorClass":"eyre::Report","httpStatus":null,"severity":"error","filePath":"src/system/compose.rs","lineNumber":641,"sourceCode":"        args.extend(self.action_args());\n        let mut commands = vec![(program, args)];\n        if let Some(command) = orphan_removal {\n            commands.push(command);\n        }\n        commands\n    }\n\n    fn run_command(&self, program: &str, args: &[String]) -> Result<()> {\n        if self.sudo {\n            crate::system::sudo::run(program, args, &compose_env())\n        } else {\n            info!(\"$ {} {}\", program, shell_words::join(args));\n            let status = Command::new(program)\n                .args(args)\n                .envs(compose_env())\n                .status()?;\n            if !status.success() {\n                bail!(\"compose command failed with {status}\");\n            }\n            Ok(())\n        }\n    }\n\n    fn stopped_orphan_removal_command(&self) -> Result<Option<(String, Vec<String>)>> {\n        let Some(args) = self.stopped_orphan_removal_args() else {\n            return Ok(None);\n        };\n        let command = self.resolved_engine_command()?;\n        command_with_args(command, args).map(Some)\n    }\n\n    fn dry_run_stopped_orphan_removal_command(&self) -> Result<Option<(String, Vec<String>)>> {\n        let Some(args) = self.stopped_orphan_removal_args() else {\n            return Ok(None);\n        };\n        command_with_args(self.configured_engine_command(), args).map(Some)","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/jdx/mise/blob/9dcfcaa0dc8747a2577d3270b69bb9d8313b2807/src/system/compose.rs#L623-L659","documentation":"`run_command` executes the resolved compose command line (detected or configured `command`, optionally under sudo via `crate::system::sudo::run`) with `compose_env()` applied, logging `$ program args` at info level. A non-zero exit from docker/compose bails with the exit status; the child's stderr — printed to the terminal — is the actual reason (port conflict, build failure, pull auth, daemon down).","triggerScenarios":"`docker compose up`/`down`/`pull` failing for any environmental reason: 'port is already allocated', image pull denied, Dockerfile build error, engine socket permission failure under sudo, or compose v2 CLI syntax unsupported by the installed version.","commonSituations":"Competing containers holding ports; registry credentials available to the user but not under `sudo = true`; compose file using features newer than the installed compose; daemon not running.","solutions":["Read the stderr above the error — it names the real cause; the mise line just above (`$ docker compose ...`) is the exact command to reproduce.","Run that logged command manually in `project_dir` with the same files/env-files to iterate on the fix.","Fix the environment (free the port, fix registry auth for the sudo context, start the engine, upgrade compose) and re-run `mise bootstrap compose apply`."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"#!/usr/bin/env bash\n# preflight the exact converge command before letting mise run it\ncd /srv/web && docker compose -f compose.yml config --quiet || exit 1\ndocker compose version | grep -q 'v2' || { echo 'compose v2 required' >&2; exit 1; }","typeGuard":null,"tryCatchPattern":"match compose::apply_with_dry_run_actions(&reqs, &actions, dry_run, yes) {\n    Ok(()) => {}\n    Err(err) if err.to_string().contains(\"compose command failed\") => {\n        // terminal: status only. The child's stderr above names the cause;\n        // reproduce with the logged `$ docker compose ...` line, fix env (port/auth/build), rerun.\n    }\n    Err(err) => return Err(err),\n}","preventionTips":["Run the logged compose command manually in project_dir to separate mise issues from docker issues.","Ensure registry credentials and engine socket are reachable in the sudo context when sudo = true.","Validate the compose file (`docker compose config --quiet`) in CI before bootstrap apply."],"tags":["mise","bootstrap","compose","docker","subprocess","exit-status"],"backgroundTag":"subprocess-nonzero-exit","analyzedSha":"9dcfcaa0dc8747a2577d3270b69bb9d8313b2807","analyzedAt":"2026-08-17T14:28:50.624Z","schemaVersion":2},"datasetVersion":"2026-08-21T13:17:26.733Z"}