risingwavelabs/risingwave · error · ResolveRegclassError

catalog error: {0}

Error message

catalog error: {0}

What it means

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.

Source

Thrown at src/frontend/src/expr/function_impl/cast_regclass.rs:33

use risingwave_common::id::ObjectId;
use risingwave_common::session_config::SearchPath;
use risingwave_expr::{ExprError, capture_context, function};
use risingwave_sqlparser::parser::{Parser, ParserError};
use thiserror::Error;
use thiserror_ext::AsReport;

use super::context::{AUTH_CONTEXT, CATALOG_READER, DB_NAME, SEARCH_PATH};
use crate::Binder;
use crate::binder::ResolveQualifiedNameError;
use crate::catalog::root_catalog::SchemaPath;
use crate::catalog::{CatalogError, CatalogReader};
use crate::session::AuthContext;

#[derive(Error, Debug)]
enum ResolveRegclassError {
    #[error("parse object name failed: {0}")]
    Parser(#[from] ParserError),
    #[error("catalog error: {0}")]
    Catalog(#[from] CatalogError),
    #[error("resolve qualified name error: {0}")]
    ResolveQualifiedName(#[from] ResolveQualifiedNameError),
}

impl From<ResolveRegclassError> for ExprError {
    fn from(e: ResolveRegclassError) -> Self {
        match e {
            ResolveRegclassError::Parser(e) => ExprError::Parse(e.to_report_string().into()),
            ResolveRegclassError::Catalog(e) => ExprError::InvalidParam {
                name: "name",
                reason: e.to_report_string().into(),
            },
            ResolveRegclassError::ResolveQualifiedName(e) => ExprError::InvalidParam {
                name: "name",
                reason: e.to_report_string().into(),
            },
        }

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Verify the object exists: run `SHOW TABLES`, `SHOW SINKS`, or `SHOW SOURCES` (or query `rw_catalog`) for the exact name.
  2. Fully qualify the object name with its schema, e.g. `nextval('public.my_seq')`, since unqualified names depend on the session search_path.
  3. Check you are connected to the correct database where the object was created.
  4. Recreate the object if it was dropped by a concurrent session.

Example fix

-- before
SELECT nextval('my_seq');
-- after
SELECT nextval('public.my_seq'); -- after confirming sequence exists via SHOW SOURCES / rw_catalog
Defensive patterns

Strategy: try-catch

Validate before calling

-- run before the expression
SELECT 1 FROM rw_catalog.rw_tables WHERE name = 'my_table' AND schema_name = 'public';

Try / catch

match resolve_regclass(name) {
    Ok(id) => use(id),
    Err(ExprError::Catalog(e)) => log::warn!("object not found in catalog: {e}"), // fallback: prompt user / list objects
    Err(e) => return Err(e),
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Not found" and "does not exist" errors: why "Task not found", "No such folder", and "Can't find" fire when a lookup comes back empty — this error's family across 14 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/95a8253e5e6b1d1a. Report an issue: GitHub.