apache/cassandra · error · InvalidRequestException

Setting bucket size to zero clears config; cannot set other

Error message

Setting bucket size to zero clears config; cannot set other fields.

What it means

Setting bucket_size to 0 in the accord_debug tracing table means 'stop tracing and clear the bucket configuration'. Combining it with any other field assignment is ambiguous and rejected with InvalidRequestException before stopping tracing.

Source

Thrown at src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java:1193

                    case "bucket_size":
                        newBucketSize = checkNonNegative(values[i], name, 0);
                        break;
                    case "bucket_sub_size":
                        newBucketSubSize = checkNonNegative(values[i], name, 0);
                        break;
                    case "bucket_seen":
                        newBucketSeen = checkNonNegative(values[i], name, 0);
                        break;
                    case "trace_events":
                        newTrace = tryParseCoordinationKinds(values[i]);
                        break;
                }
            }

            if (newBucketSize == 0)
            {
                if (newBucketMode != null || newBucketSeen > 0 || newBucketSubSize > 0 || !Float.isNaN(newChance) || (newTrace != null && !newTrace.isEmpty()))
                    throw new InvalidRequestException("Setting bucket size to zero clears config; cannot set other fields.");
                tracing().stopTracing(txnId);
            }
            else
            {
                if (newBucketSubSize == 0)
                    throw new InvalidRequestException("Cannot set bucket_sub_size to zero.");
                tracing().set(txnId, newTrace, newBucketMode, newBucketSize, newBucketSubSize, newBucketSeen, newChance, unsetManagedByOwner);
            }
        }

        @Override
        public void truncate()
        {
            tracing().eraseAllBuckets();
        }
    }

    public static final class TxnTracesTable extends AbstractMutableLazyVirtualTable

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Issue bucket_size = 0 alone in its own UPDATE to stop tracing and clear config.
  2. Apply other field updates in a separate, subsequent (or prior) statement.
  3. Adjust automation to skip writing the other fields when bucket_size is 0.

Example fix

// before
session.execute("UPDATE system_views.accord_debug_tracing SET bucket_size = 0, chance = 0.5 WHERE txn_id = '...'");
// after
session.execute("UPDATE system_views.accord_debug_tracing SET bucket_size = 0 WHERE txn_id = '...'");
session.execute("UPDATE system_views.accord_debug_tracing SET chance = 0.5 WHERE txn_id = '...'");
Defensive patterns

Strategy: validation

Validate before calling

if (setsBucketSizeZero(update) && assignmentColumnCount(update) > 1) throw new IllegalArgumentException("bucket_size=0 must be the only assignment in the statement");

Try / catch

try { session.execute(update); } catch (com.datastax.driver.core.exceptions.InvalidQueryException e) { if (e.getMessage().contains("bucket size to zero clears config")) { /* split into separate statements */ } else throw e; }

Prevention

When it happens

Trigger: Executing an UPDATE that sets bucket_size = 0 together with any of bucket_mode, bucket_seen, bucket_sub_size, chance, or a non-empty trace value in the same statement.

Common situations: Batching multiple tuning fields into one UPDATE while also disabling tracing; scripted reconfiguration that always writes all columns including zeros.

Understand the failure class

Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/baf70018046d0f9b. Report an issue: GitHub.