risingwavelabs/risingwave · error

no workers to assign; assignment is meaningless

Error message

no workers to assign; assignment is meaningless

What it means

The inner `assign_hierarchical` entry validates via `ensure!` that the worker list is non-empty; with zero workers there is nothing to assign actors/vnodes to, so the operation is refused. This is a precondition guard for the scheduling algorithm.

Source

Thrown at src/meta/src/stream/stream_graph/assignment.rs:749

        C: Ord + Hash + Eq + Clone + Debug,
    {
        let synthetic = (0..actor_count).collect::<Vec<_>>();
        vec_len_map(self.assign_actors(workers, &synthetic))
    }

    /// Hierarchical assignment: Actors → Workers → `VNodes` → Actors.
    pub fn assign_hierarchical<W, A, V>(
        &self,
        workers: &BTreeMap<W, NonZeroUsize>,
        actors: &[A],
        vnodes: &[V],
    ) -> Result<BTreeMap<W, BTreeMap<A, Vec<V>>>>
    where
        W: Ord + Hash + Eq + Clone + Debug,
        A: Ord + Hash + Eq + Copy + Debug,
        V: Hash + Eq + Copy + Debug,
    {
        ensure!(
            !workers.is_empty(),
            "no workers to assign; assignment is meaningless"
        );
        ensure!(
            !actors.is_empty(),
            "no actors to assign; assignment is meaningless"
        );
        ensure!(
            !vnodes.is_empty(),
            "no vnodes to assign; assignment is meaningless"
        );
        ensure!(
            vnodes.len() >= actors.len(),
            "not enough vnodes ({}) for actors ({}); each actor needs at least one vnode",
            vnodes.len(),
            actors.len()
        );

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Start/register at least one compute node before creating or rescheduling streaming jobs.
  2. Check worker registration in the meta service and cluster config (worker nodes addresses).
  3. In callers/tests, validate the worker list is non-empty before invoking assignment.

Example fix

// before
let plan = assign_hierarchical(&[], &actors, &vnodes, strategy)?;
// after
anyhow::ensure!(!workers.is_empty(), "no live compute workers; cannot assign actors");
let plan = assign_hierarchical(&workers, &actors, &vnodes, strategy)?;
Defensive patterns

Strategy: validation

Validate before calling

// Rust, before scheduling
if workers.is_empty() {
    anyhow::bail!("no live compute nodes registered; cannot schedule");
}

Type guard

fn has_live_workers(workers: &[WorkerId]) -> bool { !workers.is_empty() }

Try / catch

match assign_hierarchical(&workers, &actors, &vnodes, strategy) {
    Ok(m) => m,
    Err(e) if e.to_string().contains("no workers") => {
        // wait for workers and retry scheduling
        retry_with_backoff(|| schedule_job(job))
    }
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling the assignment routine (assignment.rs:749) with an empty `workers` collection — e.g. when the cluster reports no schedulable compute nodes.

Common situations: All compute nodes down or not yet registered when a streaming job is scheduled; misconfigured cluster address list resulting in zero workers; tests invoking the assignment API with empty worker lists.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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