{"record":{"id":"d8735493957c8646","repo":"risingwavelabs/risingwave","slug":"metadata-model-error-0","errorCode":null,"errorMessage":"Metadata model error: {0}","messagePattern":"Metadata model error: (.+?)","errorType":"error_code","errorClass":"MetaError","httpStatus":null,"severity":"error","filePath":"src/meta/src/error.rs","lineNumber":45,"sourceCode":"use crate::hummock::error::Error as HummockError;\nuse crate::model::MetadataModelError;\n\npub type MetaResult<T> = std::result::Result<T, MetaError>;\n\n// TODO(error-handling): provide more concrete error code for different object types.\n#[derive(\n    thiserror::Error,\n    thiserror_ext::ReportDebug,\n    thiserror_ext::Arc,\n    thiserror_ext::Construct,\n    thiserror_ext::Macro,\n)]\n#[thiserror_ext(\n    newtype(name = MetaError, backtrace, extra_provide = Self::provide_postgres_error_code),\n    macro(path = \"crate::error\")\n)]\npub enum MetaErrorInner {\n    #[error(\"Metadata model error: {0}\")]\n    MetadataModelError(\n        #[from]\n        #[backtrace]\n        MetadataModelError,\n    ),\n\n    #[error(\"Hummock error: {0}\")]\n    HummockError(\n        #[from]\n        #[backtrace]\n        HummockError,\n    ),\n\n    #[error(transparent)]\n    RpcError(\n        #[from]\n        #[backtrace]\n        RpcError,","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/meta/src/error.rs#L27-L63","documentation":"MetaError::MetadataModelError wraps the metadata model crate's errors (metadata storage/model-layer failures such as constraint violations or catalog model inconsistencies) into the unified meta error enum, formatted as 'Metadata model error: {inner}'. It indicates the error originated in the metadata model layer, not in gRPC or storage.","triggerScenarios":"Any meta-service operation that touches the metadata model (catalog creation, object management) when the underlying MetadataModelError propagates via #[from] — e.g. duplicate keys or model invariant violations in the metadata store.","commonSituations":"Corrupted or partially migrated metadata in the SQL metadata store; concurrent catalog mutations racing; bugs in model-layer validation surfacing during DDL.","solutions":["Read the wrapped inner message in the error chain for the concrete model-layer cause.","Check meta node logs and the metadata store's state around the failing operation.","Retry the DDL/statement if the cause was a transient conflict; otherwise fix the conflicting catalog object (e.g. drop/recreate).","If reproducible, report with the full error chain — it may indicate a meta-model bug."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_metadata_model_error(e: &MetaError) -> bool {\n    matches!(e, MetaError::MetadataModelError(_))\n}","tryCatchPattern":"match operation().await {\n    Err(e @ MetaError::MetadataModelError(inner)) => {\n        tracing::error!(\"metadata model failure: {inner}\");\n        // inspect inner for the concrete model-layer cause\n    }\n    other => other?,\n}","preventionTips":["Always inspect the wrapped inner error; the outer message alone is too generic.","Back up and validate the metadata store after version upgrades/migrations.","Avoid concurrent DDL on the same catalog objects in scripts."],"tags":["metadata","error-wrapper","rust","risingwave"],"backgroundTag":"database-query-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"}