{"record":{"id":"64221811dbcae203","repo":"influxdata/influxdb","slug":"table-batch-must-contain-time-column","errorCode":null,"errorMessage":"table batch must contain time column","messagePattern":"table batch must contain time column","errorType":"error_code","errorClass":"Error::MissingTime","httpStatus":null,"severity":"error","filePath":"core/mutable_batch_pb/src/decode.rs","lineNumber":108,"sourceCode":"        .map(|c| c.column_name.as_str())\n        .collect();\n    columns.sort_unstable();\n\n    let mut found_time = columns.first().is_some_and(|f| *f == TIME_COLUMN_NAME);\n\n    // it would be nice to use `array_windows` here but alas, that's nightly-only\n    for two_names in columns.windows(2) {\n        let first = two_names[0];\n        let second = two_names[1];\n        ensure!(\n            first != two_names[1],\n            DuplicateColumnNameSnafu { column: first }\n        );\n\n        found_time |= second == TIME_COLUMN_NAME;\n    }\n\n    ensure!(found_time, MissingTimeSnafu);\n\n    let mut writer = Writer::new(batch, to_insert);\n    for column in &table_batch.columns {\n        let influx_type = pb_column_type(column)?;\n        let valid_mask = compute_valid_mask(&column.null_mask, to_insert);\n        let valid_mask = valid_mask.as_deref();\n\n        // Already verified has values\n        let values = column.values.as_ref().unwrap();\n\n        match influx_type {\n            InfluxColumnType::Field(InfluxFieldType::Float) => match valid_mask {\n                None => writer.write_f64s_from_slice(&column.column_name, &values.f64_values),\n                Some(mask) => writer.write_f64s_from_slice_with_mask(\n                    &column.column_name,\n                    mask,\n                    &values.f64_values,\n                ),","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/mutable_batch_pb/src/decode.rs#L90-L126","documentation":"MissingTimeSnafu is raised by write_table_batch in mutable_batch_pb when a decoded WriteTableBatch contains no `time` column. Every IOx table batch must include the special TIME_COLUMN_NAME (\"time\") column; the decoder scans all columns (and the windowed pair check) setting found_time when it sees it, and fails with this error if none was present.","triggerScenarios":"Calling write_table_batch / decode_database_batch on a WriteTableBatch protobuf that has field/tag columns but no column named `time`.","commonSituations":"A client omitting the timestamp field when building line protocol or the protobuf batch; a serializer mapping timestamps to a custom name; partial column filtering that accidentally dropped the time column.","solutions":["Ensure the producer always includes a `time` column (the default timestamp) in every batch","If timestamps are named differently, rename the column to `time` before sending","Verify line protocol parsing code maps the timestamp position to the TIME_COLUMN_NAME column"],"exampleFix":"// before\ncolumns: [foo]\n// after\ncolumns: [foo, time]\n// producer:\nbatch.columns.push(make_time_column(timestamp_ns));","handlingStrategy":"validation","validationCode":"fn has_time_column(names: &[&str]) -> bool {\n    names.iter().any(|n| *n == \"time\")\n}\nif !has_time_column(&column_names) { /* add time column or reject */ }","typeGuard":null,"tryCatchPattern":"match write_table_batch(batch, table_batch) {\n    Err(e) if e.to_string() == \"table batch must contain time column\" => /* ensure producer sends `time` */,\n    other => other?,\n}","preventionTips":["Always include a `time` column in every WriteTableBatch","Map line-protocol timestamps to the canonical `time` column name","Assert presence of `time` in client-side batch builders"],"tags":["rust","protobuf","decode","missing-column","time-series"],"backgroundTag":"missing-required-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"}