{"record":{"id":"a3d5e17016818bb8","repo":"apache/iceberg","slug":"couldn-t-load-table-ident-in-catalog-table","errorCode":null,"errorMessage":"Couldn't load table '${ident}' in catalog '${tableCatalog.name()}'","messagePattern":"Couldn't load table '(.+?)' in catalog '(.+?)'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/procedures/BaseProcedure.java","lineNumber":159,"sourceCode":"    Preconditions.checkArgument(\n        identifierAsString != null && !identifierAsString.isEmpty(),\n        \"Cannot handle an empty identifier for argument %s\",\n        argName);\n\n    return Spark3Util.catalogAndIdentifier(\n        \"identifier for arg \" + argName, spark, identifierAsString, catalog);\n  }\n\n  protected SparkTable loadSparkTable(Identifier ident) {\n    try {\n      Table table = tableCatalog.loadTable(ident);\n      ValidationException.check(\n          table instanceof SparkTable, \"%s is not %s\", ident, SparkTable.class.getName());\n      return (SparkTable) table;\n    } catch (NoSuchTableException e) {\n      String errMsg =\n          String.format(\"Couldn't load table '%s' in catalog '%s'\", ident, tableCatalog.name());\n      throw new RuntimeException(errMsg, e);\n    }\n  }\n\n  protected Dataset<Row> loadRows(Identifier tableIdent, Map<String, String> options) {\n    String tableName = Spark3Util.quotedFullIdentifier(tableCatalog().name(), tableIdent);\n    return spark().read().options(options).table(tableName);\n  }\n\n  protected void refreshSparkCache(Identifier ident, Table table) {\n    CacheManager cacheManager = spark.sharedState().cacheManager();\n    DataSourceV2Relation relation =\n        DataSourceV2Relation.create(table, Option.apply(tableCatalog), Option.apply(ident));\n    cacheManager.recacheByPlan(spark, relation);\n  }\n\n  protected Expression filterExpression(Identifier ident, String where) {\n    try {\n      String name = Spark3Util.quotedFullIdentifier(tableCatalog.name(), ident);","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/procedures/BaseProcedure.java#L141-L177","documentation":"BaseProcedure.loadSparkTable catches Spark's NoSuchTableException when a procedure resolves its `table` argument and rethrows it as a RuntimeException stating the table could not be loaded in the given catalog. It means the procedure's table identifier was not resolvable — wrong name, wrong catalog, or the table is absent.","triggerScenarios":"Invoking any Iceberg Spark procedure (rewrite_data_files, expire_snapshots, remove_orphan_files, publish_changes, etc.) with `table => 'wrong_or_missing_name'` or an identifier that resolves in a different catalog.","commonSituations":"Typos in the table name; unqualified names resolving against the session catalog instead of the Iceberg catalog; case sensitivity mismatches; the table dropped by a concurrent job before the procedure ran.","solutions":["Verify the identifier exists: `SHOW TABLES IN catalog.db` and correct the `table` argument.","Fully qualify with catalog and namespace: `catalog.db.table`.","Check the active catalog (`SELECT current_catalog()`) or `USE catalog.db` before invoking.","Catch the RuntimeException in orchestration and handle absent tables gracefully."],"exampleFix":"// before\nCALL iceberg.system.rewrite_data_files(table => 'mytable')\n// after\nCALL iceberg.system.rewrite_data_files(table => 'iceberg_catalog.db.mytable')","handlingStrategy":"try-catch","validationCode":"boolean exists = spark.sql(\"SHOW TABLES IN \" + catalog + \".\" + db).collectAsList().stream()\n    .anyMatch(r -> r.getAs(\"tableName\").toString().equalsIgnoreCase(table));\nif (!exists) throw new IllegalArgumentException(\"Table not found: \" + catalog + \".\" + db + \".\" + table);","typeGuard":null,"tryCatchPattern":"try { spark.sql(\"CALL cat.system.rewrite_data_files(table => 'cat.db.t')\"); } catch (RuntimeException e) { if (e.getMessage() != null && e.getMessage().startsWith(\"Couldn't load table\")) { /* fix identifier or handle absence */ } throw e; }","preventionTips":["Always fully qualify procedure table identifiers as catalog.db.table.","Run SHOW TABLES to verify names before invoking procedures.","Use Spark3Util.quotedFullIdentifier for identifiers built programmatically.","Handle concurrent drops with existence checks in orchestration."],"tags":["spark","procedures","table-not-found","catalog"],"backgroundTag":"entity-not-found","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"}