{"record":{"id":"3ab75184c8099792","repo":"prestodb/presto","slug":"iceberg-filesystem-error-3ab751","errorCode":"ICEBERG_FILESYSTEM_ERROR","errorMessage":"failed to write statistics file","messagePattern":"failed to write statistics file","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableStatisticsMaker.java","lineNumber":402,"sourceCode":"                                    .flatMap(generator -> Optional.ofNullable(generator.generate(key, value, icebergTable, snapshot, typeManager)))\n                                    .ifPresent(writer::add);\n                        });\n                writer.finish();\n                icebergTable.updateStatistics().setStatistics(\n                                snapshot.snapshotId(),\n                                new GenericStatisticsFile(\n                                        snapshot.snapshotId(),\n                                        path,\n                                        writer.fileSize(),\n                                        writer.footerSize(),\n                                        writer.writtenBlobsMetadata().stream()\n                                                .map(GenericBlobMetadata::from)\n                                                .collect(toImmutableList())))\n                        .commit();\n            }\n            catch (IOException e) {\n                log.warn(e, \"failed to write table statistics file\");\n                throw new PrestoException(ICEBERG_FILESYSTEM_ERROR, \"failed to write statistics file\", e);\n            }\n        }\n    }\n\n    @FunctionalInterface\n    private interface PuffinBlobGenerator\n    {\n        @Nullable\n        Blob generate(ColumnStatisticMetadata metadata, Block value, Table icebergTable, Snapshot snapshot, TypeManager typeManager);\n    }\n\n    @FunctionalInterface\n    private interface PuffinBlobReader\n    {\n        /**\n         * Reads the stats from the blob and then updates the stats builder argument.\n         */\n        void read(BlobMetadata metadata, ByteBuffer blob, ColumnStatistics.Builder stats, Table icebergTable, TypeManager typeManager);","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/TableStatisticsMaker.java#L384-L420","documentation":"writeTableStatistics commits statistics (Puffin blob) metadata to the Iceberg table via a transaction commit; if an IOException occurs during that commit, it logs a warning and throws PrestoException(ICEBERG_FILESYSTEM_ERROR, \"failed to write statistics file\"). It signals the underlying filesystem/storage failed while persisting table statistics.","triggerScenarios":"ANALYZE table (statistics write path) where the commit to the object store/filesystem fails — I/O error, permission denied, throttling, or network interruption to S3/HDFS/GCS during blob or metadata file write.","commonSituations":"S3 throttling (503 SlowDown) or expired credentials mid-write; HDFS NameNode unavailability; quota exceeded on the storage; transient network partitions during ANALYZE.","solutions":["Check the wrapped IOException cause for the underlying filesystem error (permissions, throttling, connectivity)","Retry the ANALYZE command — statistics writes are idempotent at the metadata level for transient failures","Verify write permissions on the table location and that credentials are valid and not expiring mid-operation","Check storage health/quota (S3 bucket policy, HDFS space, GCS quotas) before re-running"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Verify write access to the table location before running ANALYZE\n// e.g. attempt a small test write/delete to the table directory, and check credential expiry","typeGuard":null,"tryCatchPattern":"try { /* ANALYZE table */ } catch (PrestoException e) {\n    if (e.getErrorCode().getName().equals(\"ICEBERG_FILESYSTEM_ERROR\")) {\n        // inspect e.getCause() (IOException) — retry transient failures, fix perms otherwise\n    } else { throw e; }\n}","preventionTips":["Ensure valid, long-enough-lived credentials for the table's storage location","Monitor object-store throttling (S3 503s) and retry ANALYZE during quiet periods","Check quotas and available space on the target filesystem","Retry ANALYZE on transient I/O failures — the write is safe to repeat"],"tags":["iceberg","filesystem","io","statistics"],"backgroundTag":"filesystem-io-error","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}