{"record":{"id":"daf66db35e848dc2","repo":"apache/iceberg","slug":"failed-to-list-partitions-of-table-s-daf66d","errorCode":null,"errorMessage":"Failed to list partitions of table %s","messagePattern":"Failed to list partitions of table (.+?)","errorType":"exception","errorClass":"CatalogException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java","lineNumber":833,"sourceCode":"    Table table = loadIcebergTable(tablePath);\n\n    if (table.spec().isUnpartitioned()) {\n      throw new TableNotPartitionedException(icebergCatalog.name(), tablePath);\n    }\n\n    Set<CatalogPartitionSpec> set = Sets.newHashSet();\n    try (CloseableIterable<FileScanTask> tasks = table.newScan().planFiles()) {\n      for (DataFile dataFile : CloseableIterable.transform(tasks, FileScanTask::file)) {\n        Map<String, String> map = Maps.newHashMap();\n        StructLike structLike = dataFile.partition();\n        PartitionSpec spec = table.specs().get(dataFile.specId());\n        for (int i = 0; i < structLike.size(); i++) {\n          map.put(spec.fields().get(i).name(), String.valueOf(structLike.get(i, Object.class)));\n        }\n        set.add(new CatalogPartitionSpec(map));\n      }\n    } catch (IOException e) {\n      throw new CatalogException(\n          String.format(\"Failed to list partitions of table %s\", tablePath), e);\n    }\n\n    return Lists.newArrayList(set);\n  }\n\n  @Override\n  public List<CatalogPartitionSpec> listPartitions(\n      ObjectPath tablePath, CatalogPartitionSpec partitionSpec) throws CatalogException {\n    throw new UnsupportedOperationException();\n  }\n\n  @Override\n  public List<CatalogPartitionSpec> listPartitionsByFilter(\n      ObjectPath tablePath, List<Expression> filters) throws CatalogException {\n    throw new UnsupportedOperationException();\n  }\n","sourceCodeStart":815,"sourceCodeEnd":851,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L815-L851","documentation":"listPartitions enumerates partitions by planning file scans over the Iceberg table and extracting partition values from each data file. If the underlying scan planning I/O fails (IOException from the FileIO layer), it is wrapped into a CatalogException with message 'Failed to list partitions of table %s'.","triggerScenarios":"Calling listPartitions when the table's metadata/data files cannot be read: missing files, unreachable storage (S3/HDFS credentials, network), corrupt manifest lists, or FileIO misconfiguration.","commonSituations":"Expired cloud credentials; HDFS NameNode unreachable; table metadata pointing to deleted snapshots; wrong warehouse/io property configuration on the catalog.","solutions":["Inspect the wrapped IOException cause to identify the storage access failure","Verify catalog FileIO/warehouse configuration and credentials for the table location","Confirm table metadata files and manifests exist and are readable at the table location","Retry if the failure was transient (network); otherwise repair or reload table metadata"],"exampleFix":"// before\nList<CatalogPartitionSpec> parts = catalog.listPartitions(tablePath);\n\n// after\ntry {\n  List<CatalogPartitionSpec> parts = catalog.listPartitions(tablePath);\n} catch (CatalogException e) {\n  LOG.warn(\"Partition listing failed for {}\", tablePath, e.getCause());\n  throw e;\n}","handlingStrategy":"retry","validationCode":"// verify table location is reachable before listing:\ntable.io().newInputFile(table.location()).getLength();","typeGuard":null,"tryCatchPattern":"try { catalog.listPartitions(tablePath); } catch (CatalogException e) { LOG.error(\"Partition listing failed: {}\", e.getCause()); }","preventionTips":["Keep cloud/HDFS credentials valid and rotated","Verify warehouse/FileIO config matches the table's storage","Monitor manifest/metadata file integrity","Retry transient network failures with backoff"],"tags":["flink","io","scan-planning","catalog"],"backgroundTag":"file-read-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"}