{"record":{"id":"8b02fb3ae5ccc7aa","repo":"apache/beam","slug":"could-not-create-catalog-s-expected-only-one-implementation","errorCode":null,"errorMessage":"Could not create catalog '%s': expected only one implementation for type '%s' but found %s","messagePattern":"Could not create catalog '(.+?)': expected only one implementation for type '(.+?)' but found (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/catalog/InMemoryCatalogManager.java","lineNumber":110,"sourceCode":"    return tableProviders;\n  }\n\n  private Catalog findAndCreateCatalog(String name, String type, Map<String, String> properties) {\n    ImmutableList.Builder<Catalog> list = ImmutableList.builder();\n    for (CatalogRegistrar catalogRegistrar :\n        ServiceLoader.load(CatalogRegistrar.class, getClass().getClassLoader())) {\n      for (Class<? extends Catalog> catalogClass : catalogRegistrar.getCatalogs()) {\n        Catalog catalog = createCatalogInstance(catalogClass, name, properties);\n        if (catalog.type().equalsIgnoreCase(type)) {\n          list.add(catalog);\n        }\n      }\n    }\n\n    List<Catalog> foundCatalogs = list.build();\n\n    if (foundCatalogs.size() > 1) {\n      throw new IllegalStateException(\n          String.format(\n              \"Could not create catalog '%s': \"\n                  + \"expected only one implementation for type '%s' but found %s\",\n              name, type, foundCatalogs.size()));\n    } else if (foundCatalogs.isEmpty()) {\n      throw new UnsupportedOperationException(\n          String.format(\"Could not find type '%s' for catalog '%s'.\", type, name));\n    }\n\n    return foundCatalogs.get(0);\n  }\n\n  private Catalog createCatalogInstance(\n      Class<? extends Catalog> catalogClass, String name, Map<String, String> properties) {\n    try {\n      return catalogClass.getConstructor(String.class, Map.class).newInstance(name, properties);\n    } catch (ReflectiveOperationException e) {\n      throw new RuntimeException(","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/apache/beam/blob/12126d8942aaf848030c478b4c6a28c6af861c66/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/catalog/InMemoryCatalogManager.java#L92-L128","documentation":"findAndCreateCatalog resolves catalog implementations via ServiceLoader (CatalogRegistrar). This guard fires when more than one registered Catalog class claims the requested type string, making the choice ambiguous, and creation is aborted with IllegalStateException.","triggerScenarios":"Thrown at sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/meta/catalog/InMemoryCatalogManager.java:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure only one catalog implementation of the given type is on the classpath; remove or de-register the duplicate registrar.","Use a more specific/unambiguous type string that maps to exactly one registered catalog."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"12126d8942aaf848030c478b4c6a28c6af861c66","analyzedAt":"2026-09-13T01:50:10.254Z","contentChangedAt":"2026-09-13T01:50:10.254Z","schemaVersion":2},"datasetVersion":"2026-09-20T03:17:13.778Z"}