influxdata/influxdb · warning
expected TS range, got bucket id
Error message
expected TS range, got bucket id
What it means
A test-only helper expect_ts_range panics when the enum holds the Bucket variant instead of TSRange. It is a narrow-down helper in proptests verifying that bucketed time partitioning produces the expected ColumnValue shapes; hitting this panic means the code produced a bucket where a timestamp range was expected.
Solutions
- Match the expectation to the template: call expect_bucket() when the template uses bucketing
- Fix the test fixture/template so it produces TSRange output if a range is what should be verified
- Inspect ColumnValue construction to see why Bucket was produced instead of TSRange
Example fix
// before
let (b, e) = got_val.expect_ts_range();
// after
let (id, num) = got_val.expect_bucket(); // template uses bucketBy
// or
if let ColumnValue::TSRange{..} = got_val { let (b,e) = got_val.expect_ts_range(); } Defensive patterns
Strategy: type-guard
Validate before calling
// in tests, check the variant before narrowing
assert!(matches!(got_val, ColumnValue::TSRange{..}), "expected TSRange, got {got_val:?}"); Type guard
fn is_ts_range(v: &ColumnValue) -> bool { matches!(v, ColumnValue::TSRange{..}) } Prevention
- Match expectations to template kind: bucketBy -> Bucket, time range -> TSRange
- Use matches! guards instead of expect_* helpers when variant may vary
- Keep fixture templates and assertions in sync
When it happens
Trigger: Calling expect_ts_range() on a variant holding ColumnValue::Bucket — i.e. the partitioner produced bucket-id output while the test expected a timestamp range (e.g. template part configured with bucketing instead of plain time range).
Common situations: Test-authoring mistakes: comparing outputs of a bucketed template against range expectations; mixing bucketBy and range-style expectations in a property test.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- expected bucket id, got string
- expected bucket id, got TS range
- expected datatime column value but got
- expected i64 got
- column id in series key should be valid
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/6606e5c51eac98aa.
Report an issue: GitHub.
Appendix: source
Thrown at core/partition/src/lib.rs:1529
String(String),
TSRange(DateTime<Utc>, DateTime<Utc>),
Bucket(u32, u32),
}
impl ExpectedColumnValue {
fn expect_string(&self) -> &String {
match self {
Self::String(s) => s,
Self::TSRange(_, _) => panic!("expected string, got TS range"),
Self::Bucket(_, _) => panic!("expected string, got bucket id"),
}
}
fn expect_ts_range(&self) -> (DateTime<Utc>, DateTime<Utc>) {
match self {
Self::String(_) => panic!("expected TS range, got string"),
Self::TSRange(b, e) => (*b, *e),
Self::Bucket(_, _) => panic!("expected TS range, got bucket id"),
}
}
fn expect_bucket(&self) -> (u32, u32) {
match self {
Self::String(_) => panic!("expected bucket id, got string"),
Self::TSRange(_, _) => panic!("expected bucket id, got TS range"),
Self::Bucket(id, num_buckets) => (*id, *num_buckets),
}
}
}
proptest! {
/// A property test that asserts a write comprised of an arbitrary
/// subset of [`TEST_TAG_NAME_SET`] with randomised values, that is
/// partitioned using a partitioning template arbitrarily selected from
/// [`TEST_TEMPLATE_PARTS`], can be reversed to the full set of tags
/// and/or hash-bucket IDs via [`build_column_values()`].View on GitHub (pinned to 06200ef96b)