{"record":{"id":"dc95ef6b67be4b54","repo":"apache/iceberg","slug":"cannot-find-source-table-s-dc95ef","errorCode":null,"errorMessage":"Cannot find source table '%s'","messagePattern":"Cannot find source table '(.+?)'","errorType":"exception","errorClass":"org.apache.iceberg.exceptions.NoSuchTableException","httpStatus":null,"severity":"error","filePath":"spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/actions/BaseTableCreationSparkAction.java","lineNumber":81,"sourceCode":"  private final String sourceTableLocation;\n  private final TableCatalog sourceCatalog;\n  private final Identifier sourceTableIdent;\n\n  // Optional Parameters for destination\n  private final Map<String, String> additionalProperties = Maps.newHashMap();\n\n  BaseTableCreationSparkAction(\n      SparkSession spark, CatalogPlugin sourceCatalog, Identifier sourceTableIdent) {\n    super(spark);\n\n    this.sourceCatalog = checkSourceCatalog(sourceCatalog);\n    this.sourceTableIdent = sourceTableIdent;\n\n    try {\n      this.sourceTable = (V1Table) this.sourceCatalog.loadTable(sourceTableIdent);\n      this.sourceCatalogTable = sourceTable.v1Table();\n    } catch (org.apache.spark.sql.catalyst.analysis.NoSuchTableException e) {\n      throw new NoSuchTableException(\"Cannot find source table '%s'\", sourceTableIdent);\n    } catch (ClassCastException e) {\n      throw new IllegalArgumentException(\n          String.format(\"Cannot use non-v1 table '%s' as a source\", sourceTableIdent), e);\n    }\n    validateSourceTable();\n\n    this.sourceTableLocation =\n        CatalogUtils.URIToString(sourceCatalogTable.storage().locationUri().get());\n  }\n\n  protected abstract TableCatalog checkSourceCatalog(CatalogPlugin catalog);\n\n  protected abstract StagingTableCatalog destCatalog();\n\n  protected abstract Identifier destTableIdent();\n\n  protected abstract Map<String, String> destTableProps();\n","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/spark/v4.2/spark/src/main/java/org/apache/iceberg/spark/actions/BaseTableCreationSparkAction.java#L63-L99","documentation":"BaseTableCreationSparkAction's constructor loads the source table from the given catalog; if Spark reports NoSuchTableException, the action rethrows Iceberg's NoSuchTableException with the identifier. The action cannot proceed without a concrete source V1 table.","triggerScenarios":"Running snapshot/migrate/inherit actions (e.g. CALL catalog.system.snapshot(...)) where the source identifier is misspelled, does not exist, or is not visible in the current namespace/catalog.","commonSituations":"Typos in table name or namespace, wrong current catalog/session catalog, table dropped concurrently, or case-sensitivity mismatches in identifier resolution.","solutions":["Verify the source table exists: SHOW TABLES IN catalog.ns and correct the identifier","Confirm the catalog and namespace in the procedure call match the actual location","Check current catalog/session settings and use a fully qualified identifier"],"exampleFix":"// before\nCALL cat.system.snapshot('spark_catalog.db.tableA', 'iceberg.db.tableA');\n// after\nCALL cat.system.snapshot('spark_catalog.db.table_a', 'iceberg.db.table_a');","handlingStrategy":"try-catch","validationCode":"// verify existence before the call\nDataset<Row> tables = spark.sql(\"SHOW TABLES IN \" + namespace);\nassert tables.filter(\"tableName = '\" + name + \"'\").count() == 1 : \"source table missing\";","typeGuard":null,"tryCatchPattern":"try { catalog.loadTable(ident); }\ncatch (org.apache.iceberg.exceptions.NoSuchTableException e) {\n  // correct identifier or create/restore the table\n  throw new IllegalArgumentException(\"Check source identifier: \" + ident, e);\n}","preventionTips":["Use fully qualified identifiers in procedure calls","Verify table existence with SHOW TABLES first","Watch for catalog/session catalog mismatches and case sensitivity"],"tags":["spark","actions","table-not-found"],"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"}