{"record":{"id":"37f3db1167ed96ae","repo":"risingwavelabs/risingwave","slug":"bounded-compaction-branch-branch-has-no-snapshot","errorCode":null,"errorMessage":"bounded compaction branch {branch} has no snapshot","messagePattern":"bounded compaction branch (.+?) has no snapshot","errorType":"exception","errorClass":"HummockError","httpStatus":null,"severity":"error","filePath":"src/storage/src/hummock/compactor/iceberg_compaction/iceberg_compactor_runner.rs","lineNumber":967,"sourceCode":"    }\n\n    let branch = commit_branch(iceberg_config.r#type.as_str(), iceberg_config.write_mode);\n\n    let table = catalog\n        .load_table(&table_ident)\n        .await\n        .map_err(|e| HummockError::compaction_executor(e.as_report()))?;\n\n    if let Some(boundary) = max_file_sequence_number {\n        // An empty bounded plan is reported as `Drained`, so fail closed unless\n        // the loaded branch can prove that this fixed boundary is meaningful.\n        if table.metadata().format_version() < FormatVersion::V2 {\n            return Err(HummockError::compaction_executor(anyhow::anyhow!(\n                \"bounded compaction requires Iceberg format V2 or V3\"\n            )));\n        }\n        let head = table.metadata().snapshot_for_ref(&branch).ok_or_else(|| {\n            HummockError::compaction_executor(anyhow::anyhow!(\n                \"bounded compaction branch {branch} has no snapshot\"\n            ))\n        })?;\n        if head.sequence_number() < boundary {\n            return Err(HummockError::compaction_executor(anyhow::anyhow!(\n                \"bounded compaction head sequence {} is older than boundary {}\",\n                head.sequence_number(),\n                boundary\n            )));\n        }\n    }\n\n    let planning_config = build_task_planning_config(\n        compaction_kind,\n        &iceberg_config,\n        &config,\n        max_file_sequence_number,\n    )?;","sourceCodeStart":949,"sourceCodeEnd":985,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/storage/src/hummock/compactor/iceberg_compaction/iceberg_compactor_runner.rs#L949-L985","documentation":"For bounded compaction the runner resolves the head snapshot of the target branch to validate the requested max_file_sequence_number boundary. If snapshot_for_ref(&branch) returns None — the branch has no snapshot (empty branch / never committed) — the boundary cannot be validated and the task fails closed.","triggerScenarios":"create_task_execution with max_file_sequence_number set, and table.metadata().snapshot_for_ref(&branch) returns None because the branch (e.g. \"main\") has no head snapshot — the table/branch has no commits yet.","commonSituations":"Submitting bounded compaction to an empty or freshly created iceberg table/sink that has never committed a snapshot; pointing compaction at a branch name that exists but has never been committed to.","solutions":["Ensure the iceberg sink has written at least one commit (a snapshot) before issuing bounded compaction; run a normal (unbounded) compaction or write data first.","Verify the branch name resolved from the table config/write mode is the branch actually holding commits.","Drop the max_file_sequence_number boundary and use the default unbounded compaction task.","Check with an Iceberg reader (e.g. Spark) that snapshots.current-snapshot-id is not -1/null for this branch."],"exampleFix":"// before\n// bounded compaction request on a table with zero commits\n\n// after: first commit data or run unbounded compaction\n// compaction request without max_file_sequence_number","handlingStrategy":"validation","validationCode":"fn branch_has_snapshot(table: &Table, branch: &str) -> bool {\n    table.metadata().snapshot_for_ref(branch).is_some()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the sink/table has committed at least one snapshot before bounded compaction.","Verify the branch name in config matches the branch that holds commits.","Prefer unbounded compaction for fresh/empty tables."],"tags":["rust","iceberg","branch","snapshot","bounded-compaction"],"backgroundTag":"resource-not-found","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"}