{"record":{"id":"81a14bfdcc5be762","repo":"risingwavelabs/risingwave","slug":"turbopuffer-document-id-column-must-be-an-integer","errorCode":null,"errorMessage":"Turbopuffer document id column must be an integer or varchar, got {:?}","messagePattern":"Turbopuffer document id column must be an integer or varchar, got (.+?)","errorType":"validation","errorClass":"SinkError::Config","httpStatus":null,"severity":"error","filePath":"src/connector/src/sink/turbopuffer.rs","lineNumber":166,"sourceCode":"    type Error = SinkError;\n\n    fn try_from(param: SinkParam) -> std::result::Result<Self, Self::Error> {\n        let schema = param.schema();\n        let pk_indices = param.downstream_pk_or_empty();\n        let [pk_index] = pk_indices.as_slice() else {\n            return Err(SinkError::Config(anyhow!(\n                \"Turbopuffer sink requires exactly one primary_key column\"\n            )));\n        };\n        let pk_index = *pk_index;\n        match schema[pk_index].data_type() {\n            DataType::Int16\n            | DataType::Int32\n            | DataType::Int64\n            | DataType::Serial\n            | DataType::Varchar => {}\n            data_type => {\n                return Err(SinkError::Config(anyhow!(\n                    \"Turbopuffer document id column must be an integer or varchar, got {:?}\",\n                    data_type\n                )));\n            }\n        };\n        let config = TurbopufferConfig::from_btreemap(param.properties)?;\n\n        let namespace = match (&config.namespace, &config.namespace_column) {\n            (Some(namespace), None) => {\n                validate_namespace(namespace)?;\n                TurbopufferNamespace::Static(namespace.clone())\n            }\n            (None, Some(namespace_column)) => {\n                let index = schema\n                    .fields()\n                    .iter()\n                    .position(|field| field.name == *namespace_column)\n                    .ok_or_else(|| {","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/src/sink/turbopuffer.rs#L148-L184","documentation":"Raised in TryFrom<SinkParam> for the Turbopuffer sink when the single primary-key column's data type is not one of the accepted integer/varchar types. Turbopuffer document IDs must be unsigned 64-bit integers, UUIDs, or strings up to 64 bytes, so a PK of e.g. floating-point or struct type cannot be used as the document id and sink creation fails.","triggerScenarios":"CREATE SINK with connector='turbopuffer' where the single PK column has an unsupported data type like Decimal, Timestamp, Float64, or a struct.","commonSituations":"Using a timestamp or decimal as the natural id; composite key collapsed into a struct/array column.","solutions":["Cast the PK column to VARCHAR (or an integer type) in an upstream materialized view","Change the id column type at the source to an integer or varchar","Pick a different unique column of supported type as the primary key"],"exampleFix":"// before\nCREATE MATERIALIZED VIEW mv AS SELECT created_at AS id, ... ; -- timestamp id\n// after\nCREATE MATERIALIZED VIEW mv AS SELECT created_at::VARCHAR AS id, ... ;","handlingStrategy":"validation","validationCode":"const t = pkColumn.type; if (!['int16','int32','int64','serial','varchar'].includes(t)) throw new Error('unsupported id type: ' + t)","typeGuard":"const isSupportedIdType = (dt) => ['Int16','Int32','Int64','Serial','Varchar'].includes(dt);","tryCatchPattern":"catch (SinkError::Config(e)) if e.contains('integer or varchar') { cast id column upstream }","preventionTips":["Cast timestamp/decimal ids to VARCHAR upstream","Prefer serial/integer surrogate keys for turbopuffer sinks","Verify PK type during schema review"],"tags":["turbopuffer","schema","type-mismatch","primary-key"],"backgroundTag":"type-mismatch","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}