risingwavelabs/risingwave · error

Failed to get compaction task for compaction_group {}

Error message

Failed to get compaction task for compaction_group {}

What it means

trigger_manual_compaction asked the HummockManager for a compaction task for a given compaction group, but the underlying task getter returned an error. The error is wrapped in an anyhow context naming the compaction group. If the inner error is Error::InvalidManualCompactionOption it is returned unwrapped instead, since it already identifies the user's bad options.

Source

Thrown at src/meta/src/hummock/manager/compaction/mod.rs:1108

                    compaction_group
                )
                .into());
            }
        };

        // 2. Get manual compaction task.
        let compact_task = self
            .manual_get_compact_task_with_info(compaction_group, manual_compaction_option)
            .await;
        let (compact_task, blocked_by_pending) = match compact_task {
            Ok((compact_task, blocked_by_pending)) => (compact_task, blocked_by_pending),
            Err(err) => {
                tracing::warn!(error = %err.as_report(), "Failed to get compaction task");
                if matches!(err, Error::InvalidManualCompactionOption(_)) {
                    return Err(err);
                }

                return Err(anyhow::anyhow!(err)
                    .context(format!(
                        "Failed to get compaction task for compaction_group {}",
                        compaction_group,
                    ))
                    .into());
            }
        };
        let compact_task = match compact_task {
            Some(compact_task) => compact_task,
            None => {
                if exclusive && blocked_by_pending {
                    return Ok(ManualCompactionTriggerResult::Retry);
                }
                // No compaction task available.
                return Err(anyhow::anyhow!(
                    "trigger_manual_compaction No compaction_task is available. compaction_group {}",
                    compaction_group
                )

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Check the inner error: if it is InvalidManualCompactionOption, fix the manual compaction options passed in the RPC (table IDs, exclusive/combinations fields).
  2. Verify the compaction_group id exists and is healthy (HummockManager versioning / group registry).
  3. Retry later if it was a transient selector error; inspect meta node logs at the warn 'Failed to get compaction task' line for the root cause.

Example fix

// before
hummock_manager.trigger_manual_compaction(ManualCompactionRequest { compaction_group: 3, table_ids: vec![999999], .. })
// after
// resolve a valid table id in the group first:
// let table_ids = hummock_manager.get_table_ids_of_group(3); // ensure 999999 is present
Defensive patterns

Strategy: try-catch

Validate before calling

// client-side: validate options before RPC
assert!(!req.compaction_group.is_none_or(|g| g == 0), "need a valid compaction group");
assert!(req.table_ids.iter().all(|id| known_tables.contains(id)), "table_ids must exist in the group");

Type guard

// rust: distinguish the meta error variant before wrapping
let is_bad_option = matches!(err, Error::InvalidManualCompactionOption(_));

Try / catch

match hummock_manager.trigger_manual_compaction(opt).await {
    Ok(_) => {},
    Err(e) if e.to_string().contains("Failed to get compaction task") => {
        // inspect root cause (invalid options vs internal) and fix options or retry
    },
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: Calling trigger_manual_compaction where get_compact_task fails: e.g. invalid manual compaction options (bad table_id list, conflicting options like combinations/exclusive), or an internal selector/storage error while picking a task for compaction_group.

Common situations: Operators issuing ALTER TABLE compact / manual compaction RPCs via psql or dashboard with a wrong table ID, a compaction group that no longer exists, or contradictory option flags; stale dashboard clients after group reconfiguration.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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