{"record":{"id":"4c3be8e0062b11bd","repo":"apache/iceberg","slug":"this-table-is-not-a-valid-iceberg-table-s","errorCode":null,"errorMessage":"This table is not a valid Iceberg table: %s","messagePattern":"This table is not a valid Iceberg table: (.+?)","errorType":"exception","errorClass":"NoSuchIcebergTableException","httpStatus":null,"severity":"error","filePath":"bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreClientImpl.java","lineNumber":584,"sourceCode":"        || table.getExternalCatalogTableOptions().isEmpty()\n        || table.getExternalCatalogTableOptions().getParameters() == null) {\n      return false;\n    }\n\n    Map<String, String> parameters = table.getExternalCatalogTableOptions().getParameters();\n\n    if (!parameters.containsKey(BaseMetastoreTableOperations.METADATA_LOCATION_PROP)\n        || !parameters.containsKey(BaseMetastoreTableOperations.TABLE_TYPE_PROP)) {\n      return false;\n    }\n\n    String tableType = parameters.get(BaseMetastoreTableOperations.TABLE_TYPE_PROP);\n    return BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE.equalsIgnoreCase(tableType);\n  }\n\n  private Table validateTable(Table table) {\n    if (!isValidIcebergTable(table)) {\n      throw new NoSuchIcebergTableException(\"This table is not a valid Iceberg table: %s\", table);\n    }\n\n    return table;\n  }\n\n  /**\n   * Converts BigQuery generic API errors to Iceberg exceptions, *without* handling the\n   * resource-specific exceptions like NoSuchTableException, NoSuchNamespaceException, etc.\n   */\n  private static HttpResponse convertExceptionIfUnsuccessful(HttpResponse response)\n      throws IOException {\n    if (response.isSuccessStatusCode()) {\n      return response;\n    }\n\n    GoogleJsonResponseException exception =\n        GoogleJsonResponseException.from(GsonFactory.getDefaultInstance(), response);\n    String errorMessage =","sourceCodeStart":566,"sourceCodeEnd":602,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreClientImpl.java#L566-L602","documentation":"BigQueryMetastoreClientImpl.validateTable checks whether a table fetched from the BigQuery metastore has the Iceberg table-type property set to 'iceberg'. If the table exists but its metadata does not identify it as an Iceberg table (or it lacks the property entirely), a NoSuchIcebergTableException is thrown. This guards create/load/update from treating a foreign (non-Iceberg) table as an Iceberg table.","triggerScenarios":"Calling Catalog.createTable, loadTable, or updateTable on a BigQueryMetastoreCatalog for a table whose BigQuery table parameters do not contain TABLE_TYPE_PROP='iceberg' — e.g. a native BigQuery table, an external table, or a table created outside Iceberg.","commonSituations":"Pointing the catalog at a BigQuery dataset containing non-Iceberg tables; a table whose metadata was hand-edited or migrated and lost the table_type property; typos in the table name resolving to a non-Iceberg object.","solutions":["Verify the target table is actually an Iceberg table created via the Iceberg BigQuery metastore catalog","Inspect the table's parameters/labels in BigQuery for the Iceberg table-type property and re-create the table through Iceberg if missing","Check for typos or wrong dataset in the table identifier so you don't resolve to a non-Iceberg table"],"exampleFix":"// before\ncatalog.loadTable(TableIdentifier.of(\"ds\", \"native_bq_table\")); // throws NoSuchIcebergTableException\n// after\nTableIdentifier id = TableIdentifier.of(\"ds\", \"iceberg_table\");\nTable table = catalog.loadTable(id); // table created via Iceberg, has table_type=iceberg","handlingStrategy":"try-catch","validationCode":"// Java: check table type before use\nboolean isIceberg = TableIdentifier.isValid(id)\n    && catalog.tableExists(id); // then ensure the table was created via the Iceberg BigQuery catalog","typeGuard":"boolean isIcebergTable(Table t) {\n  return t != null\n      && t.properties() != null\n      && BaseMetastoreTableOperations.ICEBERG_TABLE_TYPE_VALUE\n          .equalsIgnoreCase(t.properties().get(BaseMetastoreTableOperations.TABLE_TYPE_PROP));\n}","tryCatchPattern":"try {\n  Table t = catalog.loadTable(id);\n} catch (NoSuchIcebergTableException e) {\n  LOG.error(\"{} is not an Iceberg table; create it via the Iceberg catalog\", id, e);\n  throw e;\n}","preventionTips":["Only manage BigQuery tables through the Iceberg catalog if you plan to read them via Iceberg","Document which BigQuery datasets are Iceberg-managed and keep non-Iceberg tables in separate datasets","After any manual metadata edits or migrations, re-verify the table_type property is intact"],"tags":["bigquery","catalog","iceberg-table-validation"],"backgroundTag":"incompatible-source-type","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"}