{"record":{"id":"f97923f637c0f2d9","repo":"apache/iceberg","slug":"invalid-session-catalog-sparksessioncatalog-f97923","errorCode":null,"errorMessage":"Invalid session catalog: ${sparkSessionCatalog}","messagePattern":"Invalid session catalog: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java","lineNumber":370,"sourceCode":"      return;\n    }\n\n    Preconditions.checkArgument(\n        catalogHmsUri.equals(envHmsUri),\n        \"Inconsistent Hive metastore URIs: %s (Spark session) != %s (spark_catalog)\",\n        envHmsUri,\n        catalogHmsUri);\n  }\n\n  @Override\n  @SuppressWarnings(\"unchecked\")\n  public void setDelegateCatalog(CatalogPlugin sparkSessionCatalog) {\n    if (sparkSessionCatalog instanceof TableCatalog\n        && sparkSessionCatalog instanceof FunctionCatalog\n        && sparkSessionCatalog instanceof SupportsNamespaces) {\n      this.sessionCatalog = (T) sparkSessionCatalog;\n    } else {\n      throw new IllegalArgumentException(\"Invalid session catalog: \" + sparkSessionCatalog);\n    }\n  }\n\n  @Override\n  public String name() {\n    return catalogName;\n  }\n\n  private boolean useIceberg(String provider) {\n    if (provider == null || \"iceberg\".equalsIgnoreCase(provider)) {\n      return true;\n    } else if (createParquetAsIceberg && \"parquet\".equalsIgnoreCase(provider)) {\n      return true;\n    } else if (createAvroAsIceberg && \"avro\".equalsIgnoreCase(provider)) {\n      return true;\n    } else if (createOrcAsIceberg && \"orc\".equalsIgnoreCase(provider)) {\n      return true;\n    }","sourceCodeStart":352,"sourceCodeEnd":388,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java#L352-L388","documentation":"Thrown by SparkSessionCatalog.setDelegateCatalog when the CatalogPlugin configured as the Spark session catalog does not implement all three required interfaces: TableCatalog, FunctionCatalog, and SupportsNamespaces. The Iceberg session catalog wrapper can only delegate to catalogs providing that full surface.","triggerScenarios":"Setting spark.sql.catalog.<name>.impl (the session catalog delegate) to a CatalogPlugin implementation that is missing TableCatalog, FunctionCatalog, or SupportsNamespaces.","commonSituations":"Configuring spark.sql.session.catalog or sessionCatalog config with a custom catalog that only supports tables; using an older or minimal catalog implementation as the session-wide default catalog.","solutions":["Choose a delegate catalog implementation that implements TableCatalog, FunctionCatalog, and SupportsNamespaces (e.g. the built-in Spark in-memory catalog).","Update or wrap the custom CatalogPlugin to add the missing interfaces.","If the catalog cannot satisfy the interface contract, do not register it as the session catalog; register it as a named catalog instead."],"exampleFix":"// before\nspark.sql.session.catalog.impl  com.example.MinimalCatalog  // not a FunctionCatalog\n// after\nspark.sql.session.catalog.impl  org.apache.spark.sql.catalog.inMemoryTableCatalog","handlingStrategy":"validation","validationCode":"CatalogPlugin c = /* configured delegate */;\nboolean ok = c instanceof TableCatalog && c instanceof FunctionCatalog && c instanceof SupportsNamespaces;","typeGuard":"boolean isValidSessionCatalog(CatalogPlugin c) {\n  return c instanceof TableCatalog && c instanceof FunctionCatalog && c instanceof SupportsNamespaces;\n}","tryCatchPattern":"try { sessionCatalog.setDelegateCatalog(plugin); } catch (IllegalArgumentException e) { LOG.error(\"delegate catalog missing required interfaces\", e); }","preventionTips":["Verify the delegate class implements TableCatalog, FunctionCatalog, and SupportsNamespaces before registering it.","Prefer built-in catalogs (in-memory, Hive) as session catalog delegates.","Add an integration test that initializes the session catalog with the configured delegate at startup."],"tags":["spark","catalog","configuration","interface-mismatch"],"backgroundTag":"invalid-config-value","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}