{"record":{"id":"9e1e42a469a36d27","repo":"apache/iceberg","slug":"failed-to-get-table-s-from-catalog-s","errorCode":null,"errorMessage":"Failed to get table %s from catalog %s","messagePattern":"Failed to get table (.+?) from catalog (.+?)","errorType":"exception","errorClass":"UncheckedSQLException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java","lineNumber":79,"sourceCode":"    this.tableIdentifier = tableIdentifier;\n    this.fileIO = fileIO;\n    this.connections = dbConnPool;\n    this.catalogProperties = catalogProperties;\n    this.schemaVersion = schemaVersion;\n  }\n\n  @Override\n  public void doRefresh() {\n    Map<String, String> table;\n\n    try {\n      table = JdbcUtil.loadTable(schemaVersion, connections, catalogName, tableIdentifier);\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new UncheckedInterruptedException(e, \"Interrupted during refresh\");\n    } catch (SQLException e) {\n      // SQL exception happened when getting table from catalog\n      throw new UncheckedSQLException(\n          e, \"Failed to get table %s from catalog %s\", tableIdentifier, catalogName);\n    }\n\n    if (table.isEmpty()) {\n      if (currentMetadataLocation() != null) {\n        throw new NoSuchTableException(\n            \"Failed to load table %s from catalog %s: dropped by another process\",\n            tableIdentifier, catalogName);\n      } else {\n        this.disableRefresh();\n        return;\n      }\n    }\n\n    String newMetadataLocation = table.get(METADATA_LOCATION_PROP);\n    Preconditions.checkState(\n        newMetadataLocation != null,\n        \"Invalid table %s: metadata location is null\",","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/core/src/main/java/org/apache/iceberg/jdbc/JdbcTableOperations.java#L61-L97","documentation":"Thrown when reading the table's current metadata row from the JDBC catalog fails with a SQLException. This wraps database-level errors (query failure, connection problem) encountered while fetching the row in jdbc_tables. It is distinct from the table-missing case, which throws NoSuchTableException.","triggerScenarios":"JdbcTableOperations.doRefresh() → JdbcUtil.loadTable(...) throws SQLException during the SELECT against the catalog database.","commonSituations":"Transient DB outage mid-refresh, connection dropped by server, SQL syntax/schema mismatch after a catalog schema-version change, permissions revoked on the catalog tables.","solutions":["Check database health, connectivity, and server logs at the time of failure.","Verify the JDBC catalog schema exists and matches the expected version (run JdbcCatalog schema init/migration).","Confirm the catalog user retains SELECT privileges on the jdbc_tables table.","Retry the operation if the failure was transient.","Inspect the chained SQLException cause for the concrete SQL error code."],"exampleFix":"// before\n// catalog DB schema never initialized\nMap<String,String> props = Map.of(\"uri\", \"jdbc:postgresql://db/iceberg\");\n// after\n// initialize schema first\ntry (JdbcCatalog c = new JdbcCatalog()) { c.setConf(conf); c.initialize(\"jdbc\", props); }\n// or manually run schema creation: CREATE TABLE iceberg_tables (...)","handlingStrategy":"retry","validationCode":"// ensure the catalog schema exists before use\ntry (var conn = java.sql.DriverManager.getConnection(dbUrl, dbProps);\n     var rs = conn.getMetaData().getTables(null, null, \"iceberg_tables\", null)) {\n  if (!rs.next()) throw new IllegalStateException(\"Run JdbcCatalog schema initialization first\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  table.refresh();\n} catch (UncheckedSQLException e) {\n  // inspect e.getCause() SQLException for SQLState; retry transient codes (08xxx, 40001)\n  if (isTransient(e.getCause())) retryWithBackoff(() -> table.refresh());\n  else throw e;\n}","preventionTips":["Initialize the JDBC catalog schema before first use.","Grant the catalog user persistent SELECT rights.","Monitor DB health; alert on transient failure spikes."],"tags":["jdbc","database","sql"],"backgroundTag":"sql-query-failed","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"}