vectordotdev/vector · error

command: failed with exit code

Error message

command: {self:?}
  failed with exit code: {exit}

What it means

vdev's check_run runs a command and only checks its exit status. On failure it bails with "command: {self:?}\n failed with exit code: {exit}". Note the unwrap on status.code(): on Unix this is the signal-terminated case's None only in rare scenarios (normally a code exists after failure). The error tells you exactly which vdev command wrapper failed and with which exit code.

Solutions

  1. Copy the echoed `command:` line and run it directly to obtain the full compiler/test output that check_run discards.
  2. Fix the underlying failure (compile errors, missing toolchain via `rustup update`, failing tests) indicated by the direct run.
  3. Set required feature flags/environment (e.g. FEATURES=... for make test) so the invoked command succeeds.
  4. If the process was killed by a signal (no exit code), check OOM/timeout conditions in CI logs.

Example fix

// before: vdev check_run("cargo test --features x") exits 101
// run manually to see the real error:
cargo test --features x 2>&1 | head -50
// after: fix compile error / missing feature, rerun the vdev command
Defensive patterns

Strategy: try-catch

Try / catch

// Handle non-zero exits from vdev-wrapped commands
let status = std::process::Command::new("cargo").args(["test"]).status()?;
if !status.success() {
  eprintln!("underlying command failed with {:?}; inspect full output", status.code());
}
// Then rerun the exact command line echoed by the vdev error for full logs.

Prevention

When it happens

Trigger: Calling any vdev operation that internally uses check_run (e.g. exec, test flows) when the spawned process (cargo build/test, git, script) returns a non-zero exit code; also triggered when a test subcommand fails during vdev test runs.

Common situations: cargo build/test failures surfaced through vdev; scripts exiting non-zero due to environment issues (missing features, rustup toolchain absent); flaky tests returning non-zero in vdev test.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/b9682cf728bd0e35. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/app.rs:137

                "{}",
                format_command_error(&output, Some(&format!("Command: {self:?}")))
            )
        }
    }

    /// Run the command and catch its exit code.
    fn run(&mut self) -> Result<ExitStatus> {
        self.pre_exec();
        self.status().map_err(Into::into)
    }

    fn check_run(&mut self) -> Result<()> {
        let status = self.run()?;
        if status.success() {
            Ok(())
        } else {
            let exit = status.code().unwrap();
            bail!("command: {self:?}\n  failed with exit code: {exit}")
        }
    }

    /// Run the command, capture its output, and display a progress bar while it's
    /// executing. Intended to be used for long-running processes with little interaction.
    fn wait(&mut self, message: impl Into<Cow<'static, str>>) -> Result<()> {
        self.pre_exec();

        let progress_bar = get_progress_bar()?;
        progress_bar.set_message(message);

        let result = self.output();
        progress_bar.finish_and_clear();

        let Ok(output) = result else {
            bail!("could not run command")
        };

View on GitHub (pinned to bdb87aeaa4)