{"record":{"id":"923e20a97763ea30","repo":"influxdata/influxdb","slug":"time-column-must-not-contain-nulls","errorCode":null,"errorMessage":"time column must not contain nulls","messagePattern":"time column must not contain nulls","errorType":"error_code","errorClass":"Error::NullTime","httpStatus":null,"severity":"error","filePath":"core/mutable_batch_pb/src/decode.rs","lineNumber":217,"sourceCode":"                        &column.column_name,\n                        valid_mask,\n                        RepeatLastElement::new(packed_strings_iter(packed)),\n                    )\n                } else {\n                    writer.write_string(\n                        &column.column_name,\n                        valid_mask,\n                        RepeatLastElement::new(values.string_values.iter().map(|x| x.as_str())),\n                    )\n                }\n            }\n            InfluxColumnType::Field(InfluxFieldType::Boolean) => writer.write_bool(\n                &column.column_name,\n                valid_mask,\n                RepeatLastElement::new(values.bool_values.iter().cloned()),\n            ),\n            InfluxColumnType::Timestamp => {\n                ensure!(valid_mask.is_none(), NullTimeSnafu);\n                writer.write_time_from_slice(&column.column_name, &values.i64_values)\n            }\n        }\n        .context(WriteSnafu {\n            column: &column.column_name,\n        })?;\n    }\n\n    writer.commit();\n    Ok(())\n}\n\n/// Iterator wrapper that repeats the last element forever.\n///\n/// This will just yield `None` if the wrapped iterator was empty.\nstruct RepeatLastElement<I>\nwhere\n    I: Iterator,","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/mutable_batch_pb/src/decode.rs#L199-L235","documentation":"NullTimeSnafu is raised by write_table_batch in mutable_batch_pb when the batch's `time` column carries a non-null validity mask — i.e. some rows have null timestamps. IOx requires every row to have a concrete timestamp, so the decoder ensures valid_mask.is_none() for the Timestamp column before writing values via write_time_from_slice.","triggerScenarios":"Calling write_table_batch / decode_database_batch where the time column's null_mask has any false bits (null timestamps), typically because a row's timestamp field was missing or set to null in the protobuf.","commonSituations":"Producers sending rows without timestamps relying on server defaults; upstream ETL that writes optional timestamps as nulls; a serializer bug emitting a null mask for the time column even when all values exist.","solutions":["Make the producer populate a timestamp for every row so the time column has no null mask (or an all-valid mask)","Drop rows with null timestamps before sending the batch","If the null mask is spurious (all values valid), fix the serializer to emit an empty/all-true mask"],"exampleFix":"// before\n// time column null_mask with a false bit for row 2\n// after\n// either fill the timestamp or filter the row\nlet rows: Vec<_> = rows.into_iter().filter(|r| r.time.is_some()).collect();","handlingStrategy":"validation","validationCode":"fn time_column_has_nulls(null_mask: &[bool]) -> bool {\n    null_mask.iter().any(|v| !v)\n}\nif time_column_has_nulls(&time_null_mask) { /* drop offending rows before sending */ }","typeGuard":null,"tryCatchPattern":"match write_table_batch(batch, table_batch) {\n    Err(e) if e.to_string() == \"time column must not contain nulls\" => /* filter null-timestamp rows and retry */,\n    other => other?,\n}","preventionTips":["Require a timestamp on every row in producers","Filter rows with missing timestamps upstream","Never emit a null mask for the time column from serializers"],"tags":["rust","protobuf","decode","null-timestamp","data-write"],"backgroundTag":"null-argument","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}