{"record":{"id":"378381725f1af2cb","repo":"prestodb/presto","slug":"iceberg-bad-data","errorCode":"ICEBERG_BAD_DATA","errorMessage":"Error opening Iceberg split %s (offset=%s, length=%s): %s","messagePattern":"Error opening Iceberg split (.+?) \\(offset=(.+?), length=(.+?)\\): (.+?)","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java","lineNumber":439,"sourceCode":"                    pageSource,\n                    startRowPosition,\n                    endRowPosition);\n        }\n        catch (Exception e) {\n            try {\n                if (dataSource != null) {\n                    dataSource.close();\n                }\n            }\n            catch (IOException ignored) {\n            }\n            if (e instanceof PrestoException) {\n                throw (PrestoException) e;\n            }\n            String message = format(\"Error opening Iceberg split %s (offset=%s, length=%s): %s\", path, start, length, e.getMessage());\n\n            if (e instanceof ParquetCorruptionException) {\n                throw new PrestoException(ICEBERG_BAD_DATA, message, e);\n            }\n\n            if (e instanceof BlockMissingException) {\n                throw new PrestoException(ICEBERG_MISSING_DATA, message, e);\n            }\n            throw new PrestoException(ICEBERG_CANNOT_OPEN_SPLIT, message, e);\n        }\n    }\n\n    public static Optional<org.apache.parquet.schema.Type> getColumnType(\n            Map<Integer, org.apache.parquet.schema.Type> parquetIdToField,\n            MessageType messageType,\n            IcebergColumnHandle column)\n    {\n        if (isPushedDownSubfield(column)) {\n            Subfield pushedDownSubfield = getPushedDownSubfield(column);\n            List<String> encodedPath = nestedColumnPath(pushedDownSubfield).stream()\n                    .map(AvroSchemaUtil::makeCompatibleName)","sourceCodeStart":421,"sourceCodeEnd":457,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergPageSourceProvider.java#L421-L457","documentation":"When the Iceberg connector opens a data file for a split, any failure reading the underlying Parquet file is caught and rethrown as a PrestoException. If the underlying exception is a ParquetCorruptionException — i.e. the Parquet file itself is damaged or its schema/encoding does not match expectations — the connector wraps the message 'Error opening Iceberg split %s (offset=%s, length=%s): %s' with error code ICEBERG_BAD_DATA. This signals corrupted data rather than a transient infrastructure problem.","triggerScenarios":"Reading an Iceberg data split via createDataPageSource -> createParquetPageSource when the Parquet reader throws ParquetCorruptionException, e.g. malformed footer, invalid page encoding, checksum/column-chunk corruption, or schema mismatch in the .parquet file at the split's path/offset/length.","commonSituations":"Files corrupted by interrupted writes or faulty storage (HDFS/S3 truncation); files written by a newer writer using encodings this Presto version cannot decode; bit-rot or manual tampering with data files; a bad disk node serving corrupt bytes.","solutions":["Validate the file with a Parquet tool (e.g. parquet-tools/meta) at the reported path/offset to confirm corruption, then rewrite the affected data files (e.g. via an Iceberg rewrite procedure or re-running the producing job).","If files were written by a newer engine/writer, upgrade Presto to a version that supports the encodings used.","Restore the corrupted files from backup/snapshot (Iceberg rollback or expiring snapshots and re-copying data).","If corruption is spurious (e.g. bad storage node), fix the underlying storage and retry; ICEBERG_BAD_DATA is generally not fixed by retries alone."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the data file before querying (outside Presto)\n// parquet-tools meta s3a://bucket/table/data/file.parquet\n// Or in the Iceberg metadata:\nSELECT file_path, file_format FROM \"table$files\" WHERE file_format = 'PARQUET';","typeGuard":null,"tryCatchPattern":"try {\n    queryResults = execute(\"SELECT * FROM iceberg_table\");\n} catch (PrestoException e) {\n    if (\"ICEBERG_BAD_DATA\".equals(e.getErrorCode().getName())) {\n        // corrupted Parquet file: identify file from message, rewrite/restore it\n        handleCorruptFile(e);\n    } else {\n        throw e;\n    }\n}","preventionTips":["Verify data files with parquet tools after writing, especially from non-Presto writers.","Ensure the writer engine version produces encodings compatible with your Presto version.","Use checksums/ETags and storage-side integrity checks to detect corruption early.","Keep table maintenance (rewrite_data_files) to replace damaged files."],"tags":["iceberg","parquet","corruption","bad-data","read-path"],"backgroundTag":"parquet-file-corruption","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"}