risingwavelabs/risingwave · error · BatchError

task {:?} is not running

Error message

task {:?} is not running

What it means

A validation guard in BatchTaskExecution::check_if_running: it reads the task's current TaskStatus and bails unless the state is exactly Running. It fires when a client (e.g., the gRPC GetTaskOutput or abort paths) touches a task that is pending, aborted, or already finished — i.e., the caller assumed the task was executing but the state machine says otherwise. The offending input is the task_id whose state transitioned before or between the caller's requests.

Source

Thrown at src/batch/src/task/task_execution.rs:671

            .take()
            .with_context(|| {
                format!(
                    "Task{:?}'s output{} has already been taken.",
                    task_id,
                    output_id.get_output_id(),
                )
            })?;
        let task_output = TaskOutput {
            receiver,
            output_id: output_id.try_into()?,
            failure: self.failure.clone(),
        };
        Ok(task_output)
    }

    pub fn check_if_running(&self) -> Result<()> {
        if *self.state.lock() != TaskStatus::Running {
            bail!("task {:?} is not running", self.get_task_id());
        }
        Ok(())
    }

    pub fn check_if_aborted(&self) -> Result<bool> {
        match *self.state.lock() {
            TaskStatus::Aborted => Ok(true),
            TaskStatus::Finished => bail!("task {:?} has been finished", self.get_task_id()),
            _ => Ok(false),
        }
    }

    /// Check the task status: whether has ended.
    pub fn is_end(&self) -> bool {
        let guard = self.state.lock();
        !(*guard == TaskStatus::Running || *guard == TaskStatus::Pending)
    }
}

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Fetch the task's current status first and only query output/cancel when it is Running
  2. Treat this as an expected race on fast-completing tasks: if the task already finished, use the finished task's result or failure instead of the running output channel
  3. Check TaskManager for the task's terminal state and error to surface the real failure to the client
  4. Avoid tight retry loops; a task will never return to Running once it left that state
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/batch/src/task/task_execution.rs:671 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/2682e95e9603ff46. Report an issue: GitHub.