{"record":{"id":"2116d0acc175ea78","repo":"prestodb/presto","slug":"iceberg-bad-data-2116d0","errorCode":"ICEBERG_BAD_DATA","errorMessage":"Expecting Page with one channel but got N","messagePattern":"Expecting Page with one channel but got N","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/delete/IcebergDeletePageSink.java","lineNumber":197,"sourceCode":"        {\n            this.writer = createWriter();\n        }\n\n        /**\n         * @param page Only one channel. It contains the list of row positions to delete.\n         */\n        public void appendPage(Page page)\n        {\n            if (page.getChannelCount() == 1) {\n                hdfsEnvironment.doAs(session.getUser(), () -> {\n                    Block[] blocks = new Block[2];\n                    blocks[0] = new RunLengthEncodedBlock(nativeValueToBlock(VarcharType.VARCHAR, utf8Slice(dataFile)), page.getPositionCount());\n                    blocks[1] = page.getBlock(0);\n                    writer.appendRows(new Page(blocks));\n                });\n            }\n            else {\n                throw new PrestoException(ICEBERG_BAD_DATA, \"Expecting Page with one channel but got \" + page.getChannelCount());\n            }\n        }\n\n        public IcebergFileWriter getWriter()\n        {\n            return writer;\n        }\n\n        public long getSystemMemoryUsage()\n        {\n            return writer.getSystemMemoryUsage();\n        }\n\n        private IcebergFileWriter createWriter()\n        {\n            return fileWriterFactory.createFileWriter(\n                    outputPath,\n                    positionDeleteSchema,","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/delete/IcebergDeletePageSink.java#L179-L215","documentation":"IcebergDeletePageSink's inner appendPage expects a single-channel page containing just the row-position block (it wraps it with the data-file path as an RLE block to build the delete-file row). Any other channel count triggers this ICEBERG_BAD_DATA exception because the page shape is invalid for position deletes.","triggerScenarios":"Calling appendPage on the delete sink with a Page whose channel count is not 1 (e.g. page already contains path+position columns, or an empty/misconstructed page).","commonSituations":"Custom delete-writing code passing pages with (path,pos) pairs already merged; a plan bug upstream producing extra columns; misuse of the internal sink API.","solutions":["Pass a page with exactly one channel holding the delete positions (BIGINT); the sink adds the file path itself.","If your page already has path+position, drop the path channel before appending.","Check upstream operators for an accidental extra projection column feeding the delete sink."],"exampleFix":"// before\nsink.appendPage(new Page(positionBlock, pathBlock));\n// after\nsink.appendPage(new Page(positionBlock)); // only the position channel","handlingStrategy":"validation","validationCode":"if (page.getChannelCount() != 1) {\n    throw new IllegalArgumentException(\"Delete sink expects a single position channel, got \" + page.getChannelCount());\n}","typeGuard":"boolean isSingleChannelPositionPage(Page page) {\n    return page.getChannelCount() == 1 && page.getBlock(0) instanceof BigintBlock;\n}","tryCatchPattern":"try { sink.appendPage(page); } catch (PrestoException e) { if (e.getErrorCode() == ICEBERG_BAD_DATA.toErrorCode()) { /* rebuild page with one channel */ } throw e; }","preventionTips":["Feed only the position column to the delete sink","Do not pre-add the data-file path column","Add channel-count assertions in delete-writing pipelines"],"tags":["iceberg","delete-sink","page","bad-data"],"backgroundTag":"unexpected-page-channel-count","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"}