influxdata/influxdb · error
timestamp, , out of range for precision
Error message
timestamp, {}, out of range for precision: {:?} What it means
Raised by to_nanos in influxdb3_types::write when converting a timestamp to nanoseconds would overflow for the inferred precision. The multiplier for the precision (s/ms/us/ns) is applied via checked_mul, and on overflow this anyhow error reports the timestamp and precision. It prevents silently wrapping timestamps during write-path qualification (validate_and_qualify_v1_line).
Solutions
- Use nanosecond precision (precision=ns) or a timestamp already in valid nanosecond range
- Clamp/validate timestamps client-side to the supported range before writing
- Fix the client clock or timestamp-generation code producing out-of-range values
Example fix
// before let lp = "cpu,host=a usage=99 9999999999999999999"; // overflows after multiplier // after let ts_ns: i64 = ...; // validate ts_ns within supported range first assert!((MIN_VALID_NS..=MAX_VALID_NS).contains(&ts_ns));
Defensive patterns
Strategy: validation
Validate before calling
const MIN_VALID_NS: i64 = -9223372036854775808;
const MAX_VALID_NS: i64 = 9223372036854775807;
fn ts_in_range(ts: i64, multiplier: i64) -> bool {
ts.checked_mul(multiplier).is_some()
} Type guard
fn convertible_to_nanos(ts: i64, multiplier: i64) -> bool {
ts.checked_mul(multiplier).is_some()
} Try / catch
match result {
Ok(v) => v,
Err(e) if e.to_string().starts_with("timestamp") => /* 422: timestamp out of range */,
Err(e) => return Err(e),
} Prevention
- Validate timestamps against the supported range client-side before writes
- Never mix precision units; be explicit about precision
- Check server clock/time-source correctness
When it happens
Trigger: Writing a line-protocol point whose timestamp, after multiplying by the precision multiplier, exceeds i64 nanosecond range — e.g. a very large epoch timestamp with millisecond/microsecond/second precision, or DateTime values far beyond the supported modern era.
Common situations: Sending timestamps in the far future or far past (year >~2262 in ns, larger bounds for coarser precision), clients sending microseconds instead of nanoseconds while specifying a coarser precision, clock misconfiguration.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Cannot write
- line protocol parse failed
- no overflow
- partial write of line protocol occurred
- All `DataPoints` must have at least one field. Builder…
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/3e2f22cade0b51f6.
Report an issue: GitHub.
Appendix: source
Thrown at influxdb3_types/src/write.rs:56
///
/// The method properly handles Precision::Auto which is meant to infer the units of
/// the timestamp, but doesn't apply if the default is being used.
///
/// The returned value has units of nanoseconds in all cases.
pub fn to_nanos(
&self,
timestamp: Option<TimestampNoUnits>,
default_timestamp: Nanoseconds,
) -> Result<Nanoseconds, anyhow::Error> {
debug_assert!(
default_timestamp >= 0,
"in modern era, the default timestamp should be positive"
);
match timestamp {
Some(ts) => {
let multiplier = self.infer_precision(ts).multiplier();
ts.checked_mul(multiplier).ok_or_else(|| {
anyhow::anyhow!("timestamp, {}, out of range for precision: {:?}", ts, self)
})
}
None => Ok(self.truncate_to_precision(default_timestamp)),
}
}
/// truncate_to_precision rounds the provided nanosecond value towards zero to a multiple
/// of precision. If it's auto, nanos is returned unchanged.
fn truncate_to_precision(&self, nanos: i64) -> i64 {
match self {
Precision::Auto => nanos,
precision => {
let multiplier = precision.multiplier();
(nanos / multiplier) * multiplier
}
}
}
View on GitHub (pinned to 06200ef96b)