apache/beam · error · RuntimeException

Encountered an error when constructing Catalog

Error message

Encountered an error when constructing Catalog '%s'

What it means

createCatalogInstance wraps reflective instantiation of the resolved Catalog class; any exception thrown by the implementation's constructor (bad properties, missing dependencies) is rethrown as IllegalStateException naming the catalog being constructed. The root cause is the constructor failure, not the catalog type resolution.

Solutions

  1. Inspect the wrapped cause: fix the constructor failure (typically invalid catalog properties or a missing dependency).
  2. Validate the properties map against the catalog implementation's expected configuration schema before creating.
  3. Ensure the catalog implementation class can be instantiated with a no-arg/properties constructor in this environment.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/catalog/InMemoryCatalogManager.java:128 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/59bc7677f5d3b013. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/catalog/InMemoryCatalogManager.java:128

      throw new IllegalStateException(
          String.format(
              "Could not create catalog '%s': "
                  + "expected only one implementation for type '%s' but found %s",
              name, type, foundCatalogs.size()));
    } else if (foundCatalogs.isEmpty()) {
      throw new UnsupportedOperationException(
          String.format("Could not find type '%s' for catalog '%s'.", type, name));
    }

    return foundCatalogs.get(0);
  }

  private Catalog createCatalogInstance(
      Class<? extends Catalog> catalogClass, String name, Map<String, String> properties) {
    try {
      return catalogClass.getConstructor(String.class, Map.class).newInstance(name, properties);
    } catch (ReflectiveOperationException e) {
      throw new RuntimeException(
          String.format("Encountered an error when constructing Catalog '%s'", name), e);
    }
  }

  @Override
  public Collection<Catalog> catalogs() {
    return catalogs.values();
  }
}

View on GitHub (pinned to 12126d8942)