{"record":{"id":"5dfa4c0d9fbaac11","repo":"risingwavelabs/risingwave","slug":"fail-to-convert-protobuf-any-into-jsonb-0","errorCode":null,"errorMessage":"Fail to convert protobuf Any into jsonb: {0}","messagePattern":"Fail to convert protobuf Any into jsonb: (.+?)","errorType":"exception","errorClass":"AccessError","httpStatus":null,"severity":"error","filePath":"src/connector/codec/src/decoder/mod.rs","lineNumber":46,"sourceCode":"    #[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\n    /// Parquet parser specific errors\n    #[error(\"Parquet parser error: {message}\")]\n    ParquetParser { message: String },\n\n    /// Errors that are not categorized into variants above.\n    #[error(\"{message}\")]\n    Uncategorized { message: String },\n\n    #[error(transparent)]\n    NotImplemented(#[from] NotImplemented),\n    // NOTE: We intentionally don't embed `anyhow::Error` in `AccessError` since it happens\n    // in record-level and it might be too heavy to capture the backtrace\n    // when creating a new `anyhow::Error`.\n}\n\npub type AccessResult<T = Datum> = std::result::Result<T, AccessError>;","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/connector/codec/src/decoder/mod.rs#L28-L64","documentation":"AccessError::ProtobufAnyToJson in src/connector/codec/src/decoder/mod.rs:46. Thrown when converting a google.protobuf.Any value from a Protobuf payload into a jsonb: the underlying serde_json (de)serialization of the packed Any fails, and the serde_json::Error is attached as source.","triggerScenarios":"Protobuf decoder encounters a field of type google.protobuf.Any and attempts to render it (including type URL and unpacked value) as JSON via serde_json; conversion fails because the packed message cannot be serialized to the expected JSON shape (e.g. malformed Any payload, unsupported inner message).","commonSituations":"Producers writing Any fields containing message types RisingWave cannot serialize to JSON; corrupted or hand-crafted binary payloads whose Any bytes are not a valid embedded message; missing descriptors for the packed inner type.","solutions":["Avoid google.protobuf.Any in schemas consumed by RisingWave; use concrete message types or a JSON/string field","Fix the producer so Any payloads always contain a valid, descriptor-registered message","Check the source serde_json::Error in the chain to see which part of the Any JSON conversion failed","Pre-convert Any fields to plain JSON strings upstream"],"exampleFix":"// before\nmessage Wrapper { google.protobuf.Any payload = 1; }\n// after\nmessage Wrapper { string payload_json = 1; } // producer serializes inner msg to JSON text","handlingStrategy":"try-catch","validationCode":"// Producer-side guard: ensure Any fields are always packed with a known type URL\nfn any_is_valid(any: &prost_types::Any) -> bool {\n    !any.type_url.is_empty() && any.value.len() > 0\n}","typeGuard":null,"tryCatchPattern":"match decode_protobuf(bytes, desc) {\n    Ok(v) => v,\n    Err(e) if e.to_string().starts_with(\"Fail to convert protobuf Any into jsonb\") => {\n        // degrade: decode remaining fields, log offending Any\n        tracing::warn!(%e, \"skipping record with undecodable Any\");\n        default_record()\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Avoid google.protobuf.Any in schemas consumed by RW","Register descriptors for all message types packed into Any","Validate serialized Any payloads in producer tests"],"tags":["protobuf","json","any","conversion"],"backgroundTag":"protobuf-unmarshal-failed","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"}