{"record":{"id":"95a8253e5e6b1d1a","repo":"risingwavelabs/risingwave","slug":"catalog-error-0-95a825","errorCode":null,"errorMessage":"catalog error: {0}","messagePattern":"catalog error: (.+?)","errorType":"error_code","errorClass":"ResolveRegclassError","httpStatus":null,"severity":"error","filePath":"src/frontend/src/expr/function_impl/cast_regclass.rs","lineNumber":33,"sourceCode":"use risingwave_common::id::ObjectId;\nuse risingwave_common::session_config::SearchPath;\nuse risingwave_expr::{ExprError, capture_context, function};\nuse risingwave_sqlparser::parser::{Parser, ParserError};\nuse thiserror::Error;\nuse thiserror_ext::AsReport;\n\nuse super::context::{AUTH_CONTEXT, CATALOG_READER, DB_NAME, SEARCH_PATH};\nuse crate::Binder;\nuse crate::binder::ResolveQualifiedNameError;\nuse crate::catalog::root_catalog::SchemaPath;\nuse crate::catalog::{CatalogError, CatalogReader};\nuse crate::session::AuthContext;\n\n#[derive(Error, Debug)]\nenum ResolveRegclassError {\n    #[error(\"parse object name failed: {0}\")]\n    Parser(#[from] ParserError),\n    #[error(\"catalog error: {0}\")]\n    Catalog(#[from] CatalogError),\n    #[error(\"resolve qualified name error: {0}\")]\n    ResolveQualifiedName(#[from] ResolveQualifiedNameError),\n}\n\nimpl From<ResolveRegclassError> for ExprError {\n    fn from(e: ResolveRegclassError) -> Self {\n        match e {\n            ResolveRegclassError::Parser(e) => ExprError::Parse(e.to_report_string().into()),\n            ResolveRegclassError::Catalog(e) => ExprError::InvalidParam {\n                name: \"name\",\n                reason: e.to_report_string().into(),\n            },\n            ResolveRegclassError::ResolveQualifiedName(e) => ExprError::InvalidParam {\n                name: \"name\",\n                reason: e.to_report_string().into(),\n            },\n        }","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/frontend/src/expr/function_impl/cast_regclass.rs#L15-L51","documentation":"This error occurs when a catalog lookup fails while resolving an object name passed to a cast-to-regclass style expression (e.g. casting a string literal to a regclass-like type). The `ResolveRegclassError::Catalog` variant wraps a `CatalogError` via `#[from]`, and it is later converted into an `ExprError` with the message \"catalog error: {0}\". It means the referenced database object (table, sink, source, etc.) could not be found or the catalog rejected the lookup during expression evaluation in the frontend.","triggerScenarios":"Calling an expression that resolves a name to an internal catalog id (e.g. `'my_table'::regclass`-style casts, sequence lookups like `currval`/`nextval` argument resolution) when the object name does not exist in the catalog, exists in a different schema/search_path, or the session lacks visibility of the object.","commonSituations":"Referencing a table or sequence with a typo or wrong schema qualification in SQL like `SELECT nextval('my_seq')` or `SELECT 'orders'::regclass`; running against the wrong database; the object was dropped by another session before the expression was bound.","solutions":["Verify the object exists: run `SHOW TABLES`, `SHOW SINKS`, or `SHOW SOURCES` (or query `rw_catalog`) for the exact name.","Fully qualify the object name with its schema, e.g. `nextval('public.my_seq')`, since unqualified names depend on the session search_path.","Check you are connected to the correct database where the object was created.","Recreate the object if it was dropped by a concurrent session."],"exampleFix":"-- before\nSELECT nextval('my_seq');\n-- after\nSELECT nextval('public.my_seq'); -- after confirming sequence exists via SHOW SOURCES / rw_catalog","handlingStrategy":"try-catch","validationCode":"-- run before the expression\nSELECT 1 FROM rw_catalog.rw_tables WHERE name = 'my_table' AND schema_name = 'public';","typeGuard":null,"tryCatchPattern":"match resolve_regclass(name) {\n    Ok(id) => use(id),\n    Err(ExprError::Catalog(e)) => log::warn!(\"object not found in catalog: {e}\"), // fallback: prompt user / list objects\n    Err(e) => return Err(e),\n}","preventionTips":["Always schema-qualify object names in generated SQL.","Validate object existence in the catalog before building expressions referencing it.","Catch catalog errors at the session layer and surface the missing object name to the user.","Keep search_path configuration consistent across environments."],"tags":["catalog","sql","object-resolution","risingwave"],"backgroundTag":"entity-not-found","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}