{"record":{"id":"e2ecd9833621f271","repo":"risingwavelabs/risingwave","slug":"cannot-parse-value-value-with-type-got-int","errorCode":null,"errorMessage":"Cannot parse value `{value}` with type `{got}` into expected type `{expected}`","messagePattern":"Cannot parse value `(.+?)` with type `(.+?)` into expected type `(.+?)`","errorType":"exception","errorClass":"AccessError","httpStatus":null,"severity":"error","filePath":"src/connector/codec/src/decoder/mod.rs","lineNumber":30,"sourceCode":"// See the License for the specific language governing permissions and\n// limitations under the License.\n\npub mod avro;\npub mod json;\npub mod protobuf;\npub mod utils;\n\nuse risingwave_common::error::NotImplemented;\nuse risingwave_common::types::{DataType, Datum, DatumCow, ToOwnedDatum};\nuse thiserror::Error;\nuse thiserror_ext::Macro;\n\n#[derive(Error, Debug, Macro)]\n#[thiserror_ext(macro(mangle, path = \"crate::decoder\"))]\npub enum AccessError {\n    #[error(\"Undefined field `{name}` at `{path}`\")]\n    Undefined { name: String, path: String },\n    #[error(\"Cannot parse value `{value}` with type `{got}` into expected type `{expected}`\")]\n    TypeError {\n        expected: String,\n        got: String,\n        value: String,\n    },\n    #[error(\"Unsupported data type `{ty}`\")]\n    UnsupportedType { ty: String },\n\n    /// CDC auto schema change specific error that may include table context\n    #[error(\"CDC auto schema change error: unsupported data type `{ty}` in table `{table_name}`\")]\n    CdcAutoSchemaChangeError { ty: String, table_name: String },\n\n    #[error(\"Unsupported additional column `{name}`\")]\n    UnsupportedAdditionalColumn { name: String },\n\n    #[error(\"Fail to convert protobuf Any into jsonb: {0}\")]\n    ProtobufAnyToJson(#[source] serde_json::Error),\n","sourceCodeStart":12,"sourceCodeEnd":48,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/codec/src/decoder/mod.rs#L12-L48","documentation":"AccessError::TypeError in src/connector/codec/src/decoder/mod.rs:30. Thrown when a decoded value cannot be parsed/coerced into the expected RisingWave type: the value's actual runtime type (`got`) differs from the target column type (`expected`).","triggerScenarios":"A decoder accessor converts a raw value (JSON/Avro/Protobuf datum) into a RisingWave datum of the expected physical type and the wire value is of another type — e.g. a JSON string \"abc\" decoded into an INTEGER column, or a number decoded into a VARCHAR column without conversion.","commonSituations":"Producers writing wrong-typed values (sending strings for numeric fields, nulls as strings); schema registry mismatch between declared and actual Avro union branch; type changed upstream after the RW table was created.","solutions":["Fix the upstream producer to emit values matching the declared column types","Recreate the RW source/table with types matching the payload (e.g. change INTEGER to VARCHAR if payload is textual)","Add a cast in the downstream materialized view, e.g. `CAST(field AS VARCHAR)`, after declaring the column permissively","Inspect the `value`, `got`, `expected` fields in the error to pinpoint the exact offending record and field"],"exampleFix":"-- before\ncount INTEGER\n-- after (payload sends \"123\" as string)\ncount VARCHAR  -- then use count::INTEGER in queries\n","handlingStrategy":"validation","validationCode":"fn value_matches_expected(v: &serde_json::Value, expected: &str) -> bool {\n    match (expected, v) {\n        (\"integer\" | \"bigint\", serde_json::Value::Number(n)) => n.is_i64() || n.is_u64(),\n        (\"varchar\", serde_json::Value::String(_)) => true,\n        (\"boolean\", serde_json::Value::Bool(_)) => true,\n        _ => false,\n    }\n}","typeGuard":null,"tryCatchPattern":"match accessor.access(record, field) {\n    Ok(v) => v,\n    Err(AccessError::TypeError { expected, got, value }) => {\n        tracing::warn!(%expected, %got, %value, \"type mismatch; coercing\");\n        // fall back to string decode or default\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Validate payload samples against the declared schema in CI before deploying sources","Pin producer field types; avoid implicit upstream type changes","Prefer permissive column types (VARCHAR/JSONB) where payloads are heterogeneous"],"tags":["type-mismatch","decoder","parsing"],"backgroundTag":"type-mismatch","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}