influxdata/influxdb · error · DataPointError
All `DataPoints` must have at least one field. Builder…
Error message
All `DataPoints` must have at least one field. Builder contains: {:?} What it means
`DataPointError::AtLeastOneFieldRequired` is returned by `DataPointBuilder::build()` when no fields were added to the builder. An InfluxDB line-protocol data point must carry at least one field (measurement + fields are the minimal valid point); tags alone or a bare timestamp are not a valid point, so the builder refuses to construct it.
Solutions
- Add at least one `.field("name", value)` call before `.build()`.
- If fields are computed dynamically, check the field map is non-empty and skip/skip-write points with no fields.
- If a record legitimately has no fields, decide on an explicit policy: drop the record or log a warning rather than attempting to write it.
- Verify your extraction logic is not discarding all field values (e.g. null filtering too aggressive).
Example fix
// before
let point = DataPoint::builder("cpu")
.tag("host", "server01")
.build()?; // error: no fields
// after
let point = DataPoint::builder("cpu")
.tag("host", "server01")
.field("usage", 0.64)
.build()?; Defensive patterns
Strategy: validation
Validate before calling
if fields.is_empty() {
return Err("data point requires at least one field".into());
} Try / catch
match builder_result {
Err(e) if e.to_string().contains("at least one field") => {
log::debug!("skipping point with no fields");
return Ok(());
}
other => other,
} Prevention
- Always call at least one `.field(...)` before `.build()`
- Filter out points with empty field maps before writing batches
- Add a unit test asserting generated points always have >= 1 field
When it happens
Trigger: Calling `DataPoint::builder(measurement).build()` without any intervening `.field(...)` call, e.g. building points from records where all field values were filtered out as None, or only setting tags/timestamp before `build()`.
Common situations: Dynamically constructing points from JSON/CSV rows where field extraction produced an empty map; converting telemetry events where only tags were present; forgetting the builder call chain step that adds fields.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- At least one field is required
- call site contains null bytes
- Custom partition template must have at least one part
- Custom partition template specified
- database name ' ' contains invalid character, character…
AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19).
Data as JSON: /api/errors/d5df09e59a0c47bf.
Report an issue: GitHub.
Appendix: source
Thrown at core/influxdb2_client/src/models/data_point.rs:66
/// Sets a field, replacing any existing field of the same name.
pub fn field(mut self, name: impl Into<String>, value: impl Into<FieldValue>) -> Self {
self.fields.insert(name.into(), value.into());
self
}
/// Sets the timestamp, replacing any existing timestamp.
///
/// The value is treated as the number of nanoseconds since the
/// UNIX epoch.
pub fn timestamp(mut self, value: i64) -> Self {
self.timestamp = Some(value);
self
}
/// Constructs the data point
pub fn build(self) -> Result<DataPoint, DataPointError> {
ensure!(
!self.fields.is_empty(),
AtLeastOneFieldRequiredSnafu {
data_point_builder: self
}
);
let Self {
measurement,
tags,
fields,
timestamp,
} = self;
Ok(DataPoint {
measurement,
tags,
fields,
timestamp,View on GitHub (pinned to 06200ef96b)