{"record":{"id":"e69208c01c038276","repo":"apache/iceberg","slug":"invalid-session-catalog","errorCode":null,"errorMessage":"Invalid session catalog: ","messagePattern":"Invalid session catalog: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java","lineNumber":411,"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":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSessionCatalog.java#L393-L429","documentation":"setDelegateCatalog validates that the Spark session catalog plugin implements TableCatalog, FunctionCatalog, and SupportsNamespaces before delegating to it; otherwise it throws IllegalArgumentException. The delegate must support all three interfaces for SparkSessionCatalog to proxy table, function, and namespace operations.","triggerScenarios":"Configuring spark.sql.catalog.<name>.delegate to a CatalogPlugin that lacks one of the required interfaces (e.g. a custom catalog that is not a FunctionCatalog or SupportsNamespaces); wiring a legacy or minimal catalog implementation.","commonSituations":"Custom session-catalog plugins; misconfigured spark.sql.catalog.<name>.delegate pointing at an incompatible catalog class; upgrading Iceberg where delegate requirements are enforced more strictly.","solutions":["Set the delegate to a catalog that implements TableCatalog, FunctionCatalog, and SupportsNamespaces (e.g. Spark's built-in V2SessionCatalog)","Fix the spark.sql.catalog.<name>.delegate config value to point at a fully featured catalog plugin","Extend your custom catalog to implement the three required interfaces"],"exampleFix":"// before\nspark.sql.catalog.spark_catalog.delegate=com.example.MinimalCatalog\n// after\nspark.sql.catalog.spark_catalog.delegate=org.apache.spark.sql.connector.catalog.V2SessionCatalog","handlingStrategy":"validation","validationCode":"// validate delegate capabilities before wiring\nboolean valid = plugin instanceof TableCatalog\n    && plugin instanceof FunctionCatalog\n    && plugin instanceof SupportsNamespaces;","typeGuard":"boolean isUsableDelegate(CatalogPlugin p) {\n  return p instanceof TableCatalog && p instanceof FunctionCatalog && p instanceof SupportsNamespaces;\n}","tryCatchPattern":"try {\n  sessionCatalog.setDelegateCatalog(plugin);\n} catch (IllegalArgumentException e) {\n  // log which interface is missing and use a default delegate\n}","preventionTips":["Point spark.sql.catalog.<name>.delegate at a fully featured plugin like V2SessionCatalog","Unit-test custom catalog plugins against the three required interfaces"],"tags":["spark","catalog","illegal-argument","configuration"],"backgroundTag":"invalid-argument-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"}