risingwavelabs/risingwave · warning · iceberg::Error (ErrorKind::Unexpected)

register_table is not supported in mock catalog

Error message

register_table is not supported in mock catalog

What it means

register_table explicitly returns iceberg::Error with ErrorKind::Unexpected and the message "register_table is not supported in mock catalog". Unlike the other stubs it is a deliberate, catchable error rather than a panic, signaling that registering an existing metadata file is outside the mock's scope.

Source

Thrown at src/connector/src/connector_common/iceberg/mock_catalog.rs:264

    async fn rename_table(&self, _src: &TableIdent, _dest: &TableIdent) -> iceberg::Result<()> {
        todo!()
    }

    /// Update a table to the catalog.
    async fn update_table(&self, _commit: TableCommit) -> iceberg::Result<Table> {
        todo!()
    }

    #[expect(
        clippy::disallowed_types,
        reason = "iceberg catalog trait requires returning iceberg::Error"
    )]
    async fn register_table(
        &self,
        _table_ident: &TableIdent,
        _metadata_location: String,
    ) -> iceberg::Result<Table> {
        Err(iceberg::Error::new(
            iceberg::ErrorKind::Unexpected,
            "register_table is not supported in mock catalog",
        ))
    }
}

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Do not test register_table against this mock; use a real catalog
  2. Change the error to ErrorKind::FeatureUnsupported if callers branch on error kind
  3. Implement the stub to return a fixture Table if registration behavior is needed in tests

Example fix

// before
Err(iceberg::Error::new(
    iceberg::ErrorKind::Unexpected,
    "register_table is not supported in mock catalog",
))
// after
Err(iceberg::Error::new(
    iceberg::ErrorKind::FeatureUnsupported,
    "register_table is not supported in mock catalog",
))
Defensive patterns

Strategy: try-catch

Validate before calling

// register_table is explicitly unsupported; check capability before calling
if is_mock_catalog(&catalog) { return Err(anyhow!("register_table unsupported")); }

Type guard

fn supports_register(c: &dyn Catalog) -> bool { /* MockIcebergCatalog -> false */ false }

Try / catch

match catalog.register_table(&ident, metadata_location).await {
    Err(e) if e.message().contains("not supported in mock catalog") => {
        // fall back to load_table or skip the test
    }
    other => other?,
}

Prevention

When it happens

Trigger: Calling register_table(ident, metadata_location) on MockIcebergCatalog.

Common situations: Testing recovery/registration flows that attach an existing Iceberg table by metadata location; generic trait-exercising test harnesses.

Related errors


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