{"record":{"id":"097ffc197480ee35","repo":"apache/iceberg","slug":"couldn-t-load-table-s-in-catalog-s","errorCode":null,"errorMessage":"Couldn't load table '%s' in catalog '%s'","messagePattern":"Couldn't load table '(.+?)' in catalog '(.+?)'","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/procedures/BaseProcedure.java","lineNumber":175,"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":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/procedures/BaseProcedure.java#L157-L193","documentation":"BaseProcedure.loadSparkTable resolves a table identifier through the given Spark catalog and expects an Iceberg SparkTable. If SparkV2Catalog.lookupTable throws NoSuchTableException, the procedure wraps it in a RuntimeException with the table identifier and catalog name. It signals that the procedure's target table could not be resolved at all.","triggerScenarios":"Calling a procedure such as rewrite_data_files(table => '...') or remove_orphan_files with an identifier that doesn't exist, is a view, is misqualified (wrong catalog/database), or whose case doesn't match the catalog's lookup rules.","commonSituations":"Typos in the qualified name; using a Spark session catalog name that isn't registered; the table exists in another catalog (e.g. spark_catalog vs iceberg catalog); pointing at a path-based identifier without proper quoting.","solutions":["Verify the identifier exists: SHOW TABLES IN <catalog>.<db> and confirm exact spelling/case.","Qualify the name fully with the Iceberg catalog: catalog.namespace.table (use backticks for special chars).","Check spark.sql.catalog.<name> configuration points at the Iceberg catalog implementation.","If you control the code, catch the thrown RuntimeException and surface the NoSuchTableException cause."],"exampleFix":"-- before\nCALL iceberg.system.rewrite_data_files(table => 'db1.tbl');\n-- after (correct catalog + case)\nCALL iceberg.system.rewrite_data_files(table => 'my_db.my_table');","handlingStrategy":"try-catch","validationCode":"SHOW TABLES IN catalog.db; -- or spark.catalog.tableExists(\"catalog.db.table\") in Scala","typeGuard":null,"tryCatchPattern":"try { procedureCall(...); } catch (RuntimeException e) { if (e.getCause() instanceof NoSuchTableException) { /* handle missing table */ } else throw e; }","preventionTips":["Always fully qualify identifiers as catalog.namespace.table.","Verify table existence before invoking procedures.","Backtick-quote identifiers with special characters."],"tags":["spark","procedure","table-not-found"],"backgroundTag":"resource-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"}