{"record":{"id":"cacf5e7958f1fe67","repo":"apache/iceberg","slug":"failed-to-list-partitions-of-table-s","errorCode":null,"errorMessage":"Failed to list partitions of table %s","messagePattern":"Failed to list partitions of table (.+?)","errorType":"exception","errorClass":"org.apache.iceberg.flink.CatalogException","httpStatus":null,"severity":"error","filePath":"flink/v1.20/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/v1.20/flink/src/main/java/org/apache/iceberg/flink/FlinkCatalog.java#L815-L851","documentation":"FlinkCatalog.listPartitions wraps IOException from Iceberg file scan planning (table.newScan().planFiles()) into a CatalogException with message \"Failed to list partitions of table %s\". Partition listing enumerates data-file partitions via a file-planning scan; if the underlying metadata/data files cannot be read (I/O failure), this exception is thrown with the table path and the original IOException as cause.","triggerScenarios":"Calling FlinkCatalog.listPartitions on a partitioned Iceberg table when planFiles() raises IOException — e.g. missing/corrupt manifest files, unreadable object store, credentials expired, network partition to HDFS/S3 during manifest read.","commonSituations":"S3/GCS/Azure credentials rotated or expired between table load and scan; metadata file deleted by retention job while a snapshot still references it; transient network failure to the storage layer; misconfigured FileIO (wrong endpoint/region).","solutions":["Inspect the cause chain (e.getCause()) for the real I/O error (403, NoSuchKey, timeout) and fix storage access accordingly.","Refresh/validate storage credentials (FileIO configuration, IAM role, instance profile) and retry.","Retry the listing — planFiles is a read-only scan and transient network failures are common.","Check that referenced manifests/snapshots still exist (expireSnapshots misconfiguration can delete live metadata).","Verify FileIO/storage endpoint configuration (region, endpoint) matches the warehouse location."],"exampleFix":"// before\nList<CatalogPartitionSpec> parts = catalog.listPartitions(tablePath);\n\n// after\ntry {\n  List<CatalogPartitionSpec> parts = catalog.listPartitions(tablePath);\n} catch (CatalogException e) {\n  if (e.getCause() instanceof IOException) {\n    // retry transient storage I/O failure\n    parts = retryList(catalog, tablePath);\n  } else {\n    throw e;\n  }\n}","handlingStrategy":"retry","validationCode":"// pre-check storage reachability before listing\nTable t = icebergTable(tablePath); Preconditions.checkArgument(t != null && !t.spec().isUnpartitioned());","typeGuard":null,"tryCatchPattern":"try { return catalog.listPartitions(tablePath); } catch (CatalogException e) { if (e.getCause() instanceof IOException && isTransient(e.getCause())) { return retryList(tablePath); } throw e; }","preventionTips":["Keep storage credentials valid and refreshed (S3/GCS/Azure)","Avoid deleting manifests still referenced by live snapshots (expireSnapshots settings)","Retry transient I/O failures on planFiles-based operations","Validate FileIO endpoint/region configuration matches the warehouse"],"tags":["flink","iceberg","io","scan-planning","storage"],"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"}