{"record":{"id":"7105802b84b52ee4","repo":"apache/iceberg","slug":"nosuchtableexception-ident-710580","errorCode":null,"errorMessage":"NoSuchTableException(ident)","messagePattern":"NoSuchTableException\\(ident\\)","errorType":"exception","errorClass":"NoSuchTableException","httpStatus":404,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java","lineNumber":55,"sourceCode":"  private static final String CLASS_NAME = SparkRewriteTableCatalog.class.getName();\n  private static final SparkTableCache TABLE_CACHE = SparkTableCache.get();\n\n  private String name = null;\n\n  @Override\n  public Identifier[] listTables(String[] namespace) {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support listing tables\");\n  }\n\n  @Override\n  public SparkRewriteTable loadTable(Identifier ident) throws NoSuchTableException {\n    validateNoNamespace(ident);\n\n    String groupId = ident.name();\n    Table table = TABLE_CACHE.get(groupId);\n\n    if (table == null) {\n      throw new NoSuchTableException(ident);\n    }\n\n    return new SparkRewriteTable(table, groupId);\n  }\n\n  @Override\n  public SparkTable loadTable(Identifier ident, String version) throws NoSuchTableException {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support time travel\");\n  }\n\n  @Override\n  public SparkTable loadTable(Identifier ident, long timestampMicros) throws NoSuchTableException {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support time travel\");\n  }\n\n  @Override\n  public void invalidateTable(Identifier ident) {\n    throw new UnsupportedOperationException(CLASS_NAME + \" does not support table invalidation\");","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/SparkRewriteTableCatalog.java#L37-L73","documentation":"SparkRewriteTableCatalog.loadTable resolves tables only from the in-memory SparkTableCache populated by a rewrite procedure; if the group id is absent from the cache it throws Spark's NoSuchTableException. The catalog intentionally cannot load arbitrary tables.","triggerScenarios":"Calling loadTable(ident) where ident.name() is not a group id currently registered in SparkTableCache, e.g. loading a table by its real name outside an active rewrite procedure.","commonSituations":"Querying tables through a rewrite catalog binding outside the rewrite procedure's execution; using a stale group id after the procedure finished; misconfigured catalog binding.","solutions":["Run table access through a normal catalog; the rewrite catalog only works within procedure execution","Ensure the identifier corresponds to an active rewrite group id created by the procedure","Register the table in SparkTableCache with the same group id if writing framework code"],"exampleFix":"// before\nval table = spark.sessionState.catalogManager.catalog(\"prod\").asTableCatalog.loadTable(ident) // rewrite catalog\n// after\nval table = spark.table(\"prod.db.events\") // use the normal Iceberg catalog binding","handlingStrategy":"try-catch","validationCode":"if (!spark.sessionState.catalogManager.isCatalogRegistered(\"prod\")) ??? // prefer standard catalog for loads","typeGuard":null,"tryCatchPattern":"try {\n  catalog.loadTable(ident)\n} catch {\n  case _: NoSuchTableException => loadViaSparkCatalog(ident)\n}","preventionTips":["Do not resolve tables through the rewrite catalog outside procedure execution","Ensure group ids match those created by the running rewrite procedure","Configure user-facing catalog bindings to SparkCatalog"],"tags":["spark","catalog","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-23T08:17:48.524Z"}