diem/diem · error

Command {:?} failed with exit status: {}

Error message

Command {:?} failed with exit status: {}

What it means

join() waits for the spawned command to finish; if the exit status is not success, the library bails with the command and its exit status. It reports the underlying external process (e.g. a backup/storage CLI) failed, not a bug in this library.

Source

Thrown at storage/backup/backup-cli/src/storage/command_adapter/command.rs:117

    pub fn stdin(&mut self) -> &mut ChildStdin {
        self.child.stdin.as_mut().unwrap()
    }

    pub fn into_data_source<'a>(self) -> ChildStdoutAsDataSource<'a> {
        ChildStdoutAsDataSource::new(self)
    }

    pub fn into_data_sink<'a>(self) -> ChildStdinAsDataSink<'a> {
        ChildStdinAsDataSink::new(self)
    }

    pub async fn join(self) -> Result<()> {
        match self.child.wait_with_output().await {
            Ok(output) => {
                if output.status.success() {
                    Ok(())
                } else {
                    bail!(
                        "Command {:?} failed with exit status: {}",
                        self.command,
                        output.status
                    )
                }
            }
            Err(e) => bail!("Failed joining command {:?}: {}", self.command, e),
        }
    }
}

pub(super) struct ChildStdoutAsDataSource<'a> {
    child: Option<SpawnedCommand>,
    join_fut: Option<BoxFuture<'a, Result<()>>>,
}

impl<'a> ChildStdoutAsDataSource<'a> {
    fn new(child: SpawnedCommand) -> Self {

View on GitHub (pinned to fc4714a8ea)

Solutions

  1. Read the exit status from the message and run the command manually to see stderr
  2. Fix the arguments/config passed into the command adapter
  3. Check the external tool's logs, permissions, and required environment

Example fix

// before
Command::new("backup-tool").arg(wrong_path)
// after
Command::new("backup-tool").arg(validated_path).arg("--verbose")
Defensive patterns

Strategy: try-catch

Try / catch

match cmd.join().await { Ok(()) => Ok(()), Err(e) if e.to_string().contains("failed with exit status") => { log_stderr_hint(&e); Err(e) } Err(e) => Err(e) }

Prevention

When it happens

Trigger: Any spawned command exits with non-zero status, detected via wait_with_output().

Common situations: Wrong arguments or paths passed to the external tool; tool missing permissions; disk full; tool version mismatch.

Related errors


AI-assisted analysis of diem/diem@fc4714a8ea (2026-09-04). Data as JSON: /api/errors/e43bfc29ab9230b8. Report an issue: GitHub.