{"record":{"id":"41c379d8c92bd053","repo":"risingwavelabs/risingwave","slug":"failed-to-get-compaction-task-for-compaction-group","errorCode":null,"errorMessage":"Failed to get compaction task for compaction_group {}","messagePattern":"Failed to get compaction task for compaction_group (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/meta/src/hummock/manager/compaction/mod.rs","lineNumber":1108,"sourceCode":"                    compaction_group\n                )\n                .into());\n            }\n        };\n\n        // 2. Get manual compaction task.\n        let compact_task = self\n            .manual_get_compact_task_with_info(compaction_group, manual_compaction_option)\n            .await;\n        let (compact_task, blocked_by_pending) = match compact_task {\n            Ok((compact_task, blocked_by_pending)) => (compact_task, blocked_by_pending),\n            Err(err) => {\n                tracing::warn!(error = %err.as_report(), \"Failed to get compaction task\");\n                if matches!(err, Error::InvalidManualCompactionOption(_)) {\n                    return Err(err);\n                }\n\n                return Err(anyhow::anyhow!(err)\n                    .context(format!(\n                        \"Failed to get compaction task for compaction_group {}\",\n                        compaction_group,\n                    ))\n                    .into());\n            }\n        };\n        let compact_task = match compact_task {\n            Some(compact_task) => compact_task,\n            None => {\n                if exclusive && blocked_by_pending {\n                    return Ok(ManualCompactionTriggerResult::Retry);\n                }\n                // No compaction task available.\n                return Err(anyhow::anyhow!(\n                    \"trigger_manual_compaction No compaction_task is available. compaction_group {}\",\n                    compaction_group\n                )","sourceCodeStart":1090,"sourceCodeEnd":1126,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/hummock/manager/compaction/mod.rs#L1090-L1126","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the inner error: if it is InvalidManualCompactionOption, fix the manual compaction options passed in the RPC (table IDs, exclusive/combinations fields).","Verify the compaction_group id exists and is healthy (HummockManager versioning / group registry).","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."],"exampleFix":"// before\nhummock_manager.trigger_manual_compaction(ManualCompactionRequest { compaction_group: 3, table_ids: vec![999999], .. })\n// after\n// resolve a valid table id in the group first:\n// let table_ids = hummock_manager.get_table_ids_of_group(3); // ensure 999999 is present","handlingStrategy":"try-catch","validationCode":"// client-side: validate options before RPC\nassert!(!req.compaction_group.is_none_or(|g| g == 0), \"need a valid compaction group\");\nassert!(req.table_ids.iter().all(|id| known_tables.contains(id)), \"table_ids must exist in the group\");","typeGuard":"// rust: distinguish the meta error variant before wrapping\nlet is_bad_option = matches!(err, Error::InvalidManualCompactionOption(_));","tryCatchPattern":"match hummock_manager.trigger_manual_compaction(opt).await {\n    Ok(_) => {},\n    Err(e) if e.to_string().contains(\"Failed to get compaction task\") => {\n        // inspect root cause (invalid options vs internal) and fix options or retry\n    },\n    Err(e) => return Err(e),\n}","preventionTips":["Validate manual compaction options (table IDs, exclusive/combinations) before sending","Resolve compaction group ids from the manager, never hardcode","Log the inner error, not just the wrapped context"],"tags":["compaction","meta","hummock"],"backgroundTag":"invalid-argument-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}