vectordotdev/vector · error
could not run command
Error message
could not run command
What it means
In vdev's `wait` helper, a Command is spawned with output captured while a progress bar runs. When `self.output()` returns Err (the child process could not be spawned at all — e.g. the executable was not found or spawning failed), the helper bails with the generic message "could not run command". This error signals that the command never executed, as opposed to executing and failing (which produces the `format_command_error` message instead).
Solutions
- Install or fix the external binary so it exists on PATH (`which <tool>` to verify).
- Check the `Executing: {self:?}` debug output (run with debug logging) to see the exact command and cwd that failed to spawn.
- Verify the working directory passed to the command exists (e.g. repo root resolved correctly).
- If authoring vdev code, use `format_command_error`/context on the spawn failure so the underlying io::Error is surfaced instead of the generic message.
Example fix
// before
let Ok(output) = result else {
bail!("could not run command")
};
// after
let Ok(output) = result else {
bail!("could not run command `{self:?}`: {}", result.unwrap_err())
}; Defensive patterns
Strategy: try-catch
Validate before calling
// before invoking the vdev flow, ensure the binary is available
if which::which("docker").is_err() {
eprintln!("required tool not on PATH");
} Type guard
fn is_spawn_failure(err: &anyhow::Error) -> bool {
err.chain().any(|c| c.downcast_ref::<std::io::Error>().is_some())
} Try / catch
match cmd.wait("building") {
Err(e) if is_spawn_failure(&e) => eprintln!("tool missing/failed to spawn: {e}"),
Err(e) => eprintln!("command failed: {e}"),
Ok(()) => {}
} Prevention
- Verify external tools are installed and on PATH before running vdev commands.
- Run vdev with debug logging to see the exact command, cwd, and env used.
- Ensure the working directory passed to commands exists (e.g. correct repo checkout).
When it happens
Trigger: Calling `App::wait(...)` (vdev/src/app.rs:143) when the wrapped `Command` fails to spawn: the binary is not on PATH, an invalid working directory was set via `current_dir`, or an invalid environment/program configuration makes `output()` return Err.
Common situations: Running vdev on a machine without a required external tool installed (e.g. `gh`, `docker`, `cargo` component missing); a typo'd binary name in a vdev command implementation; setting a `current_dir` that no longer exists before spawning.
Related errors
- already exists
- already exists. Delete it (or move it aside) and re-run.
- already exists for release . Delete it (or move it aside)…
- {}
- Bad fragment filename
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/a0e1a28dd2cbfdaf.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/app.rs:153
} 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")
};
if output.status.success() {
Ok(())
} else {
bail!("{}", format_command_error(&output, None))
}
}
/// Print out a pre-execution debug message.
fn pre_exec(&self) {
debug!("Executing: {self:?}");
if let Some(cwd) = self.get_current_dir() {
debug!(" in working directory {cwd:?}");
}
for (key, value) in self.get_envs() {
let key = key.to_string_lossy();
if let Some(value) = value {View on GitHub (pinned to bdb87aeaa4)