{"record":{"id":"7998f2bec80fcd02","repo":"risingwavelabs/risingwave","slug":"pb-decode-error-0-7998f2","errorCode":null,"errorMessage":"Pb decode error: {0}","messagePattern":"Pb decode error: (.+?)","errorType":"exception","errorClass":"MetadataModelError","httpStatus":null,"severity":"error","filePath":"src/meta/src/model/error.rs","lineNumber":24,"sourceCode":"//\n//     http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nuse anyhow::anyhow;\nuse risingwave_pb::PbFieldNotFound;\nuse risingwave_rpc_client::error::ToTonicStatus;\nuse thiserror::Error;\n\npub type MetadataModelResult<T> = std::result::Result<T, MetadataModelError>;\n\n#[derive(Error, Debug)]\npub enum MetadataModelError {\n    #[error(\"Pb decode error: {0}\")]\n    PbDecode(#[from] prost::DecodeError),\n\n    #[error(transparent)]\n    InternalError(\n        #[from]\n        #[backtrace]\n        anyhow::Error,\n    ),\n}\n\nimpl From<PbFieldNotFound> for MetadataModelError {\n    fn from(p: PbFieldNotFound) -> Self {\n        MetadataModelError::InternalError(anyhow::anyhow!(\n            \"Failed to decode prost: field not found `{}`\",\n            p.0\n        ))\n    }\n}","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/model/error.rs#L6-L42","documentation":"`MetadataModelError::PbDecode` wraps a `prost::DecodeError` raised while decoding a protobuf-encoded metadata model (e.g. actor, fragment, sink, or database objects stored in the meta backend). It means bytes persisted in the metadata store cannot be parsed with the current protobuf schema — typically version skew or store corruption.","triggerScenarios":"Any meta service call that loads a persisted metadata model whose stored bytes fail prost decoding (schema changed between versions, truncated/corrupt row, wrong key type read).","commonSituations":"RisingWave upgrade/downgrade with changed protobuf definitions; manual tampering or corruption of the metadata store; writing with a newer version and reading with an older binary.","solutions":["Pin all components (meta, frontend, compute) to the same RisingWave version so the schema matches the stored data.","Identify the specific object being decoded from the surrounding error context and delete/recreate it if it's safely rebuildable (e.g. a stale sink or materialized view).","If corruption is systemic, restore the metadata store from backup or re-bootstrap the cluster.","Never downgrade below the version that wrote the metadata; run schema-compatible upgrades."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Validate stored bytes can be decoded before use\nlet mut buf = bytes.as_slice();\nlet decoded = T::decode(&mut buf)\n    .map_err(MetadataModelError::PbDecode)?;","typeGuard":null,"tryCatchPattern":"match load_metadata_model(key).await {\n    Err(MetadataModelError::PbDecode(de)) => {\n        tracing::error!(\"corrupt/incompatible metadata at {key}: {de}; recreate or restore from backup\");\n    }\n    other => { /* normal handling */ }\n}","preventionTips":["Never downgrade below the version that wrote the metadata store","Keep all cluster components on the same version","Back up the metadata store before upgrades; test restore procedures"],"tags":["rust","meta","protobuf","decode","metadata-model"],"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-14T16:17:12.679Z"}