{"record":{"id":"d46365ab9b0c31e1","repo":"influxdata/influxdb","slug":"we-should-never-receive-an-unspecified-type-in-a-tablebatch","errorCode":null,"errorMessage":"We should never receive an unspecified type in a TableBatch","messagePattern":"We should never receive an unspecified type in a TableBatch","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/partition/src/traits.rs","lineNumber":167,"sourceCode":"                .and_then(|s| s.dictionary.as_ref())\n                .map(|dict| {\n                    let start =\n                        usize::try_from(dict.offsets[usize::try_from(*tag_identity_key).unwrap()])\n                            .unwrap();\n                    let end = usize::try_from(\n                        dict.offsets[usize::try_from(tag_identity_key + 1).unwrap()],\n                    )\n                    .unwrap();\n                    dict.values.split_at(start).1.split_at(end - start).0\n                }),\n            _ => None,\n        }\n    }\n\n    fn type_description(&self) -> String {\n        match self.semantic_type() {\n            SemanticType::Unspecified => {\n                unreachable!(\"We should never receive an unspecified type in a TableBatch\")\n            }\n            SemanticType::Tag => InfluxColumnType::Tag.to_string(),\n            SemanticType::Time => InfluxColumnType::Timestamp.to_string(),\n            SemanticType::Field => {\n                let Values {\n                    i64_values,\n                    f64_values,\n                    u64_values,\n                    string_values,\n                    bool_values,\n                    bytes_values: _,\n                    packed_string_values,\n                    interned_string_values,\n                } = self.values.as_ref().unwrap();\n\n                if !i64_values.is_empty() {\n                    InfluxColumnType::Field(schema::InfluxFieldType::Integer).to_string()\n                } else if !f64_values.is_empty() {","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/partition/src/traits.rs#L149-L185","documentation":"unreachable!(\"We should never receive an unspecified type in a TableBatch\") panic in TableBatch::type_description: the method maps a column's SemanticType to an InfluxColumnType description, and SemanticType::Unspecified is considered invalid for any column inside a TableBatch. Reaching that match arm means schema metadata carried a column whose semantic type was never set.","triggerScenarios":"Constructing a TableBatch whose columns include a field with SemanticType::Unspecified — e.g. schema built without calling the semantic-type inference, deserializing old/partial schema metadata, or a default() derived column that never got a real type.","commonSituations":"Schema deserialization from older format versions that lacked semantic types, hand-written test schemas using Default::default() for SemanticType, or upstream writers failing to tag columns as Tag/Time/Field.","solutions":["Ensure every column's SemanticType is explicitly set to Tag, Time, or Field when building the TableBatch schema","Validate the schema before constructing the batch, rejecting Unspecified semantic types early","Replace unreachable! with a Result error for resilience against legacy metadata","Check deserialization code for defaulting to SemanticType::Unspecified on missing fields"],"exampleFix":"// before\nSemanticType::Unspecified => {\n    unreachable!(\"We should never receive an unspecified type in a TableBatch\")\n}\n// after\nSemanticType::Unspecified => return Err(SchemaError::UnspecifiedSemanticType),","handlingStrategy":"validation","validationCode":"// rust\nfn all_semantic_types_set(cols: &[ColumnDef]) -> bool {\n    cols.iter().all(|c| c.semantic_type() != SemanticType::Unspecified)\n}","typeGuard":null,"tryCatchPattern":"match col.semantic_type() {\n    SemanticType::Unspecified => return Err(SchemaError::UnspecifiedSemanticType),\n    other => /* proceed with other */ (),\n}","preventionTips":["Explicitly set Tag/Time/Field semantic types when building TableBatch schemas","Validate schemas at deserialization time, rejecting Unspecified values","Avoid Default::default() for SemanticType in fixtures and writers"],"tags":["rust","panic","unreachable","schema","semantic-type"],"backgroundTag":"invalid-enum-value","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"}