{"record":{"id":"dae731421e9c2ad9","repo":"prestodb/presto","slug":"iceberg-writer-open-error","errorCode":"ICEBERG_WRITER_OPEN_ERROR","errorMessage":"Error creating Parquet file","messagePattern":"Error creating Parquet file","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergFileWriterFactory.java","lineNumber":178,"sourceCode":"            return new IcebergParquetFileWriter(\n                    hdfsEnvironment.doAs(session.getUser(), () -> fileSystem.create(outputPath)),\n                    rollbackAction,\n                    fileColumnNames,\n                    fileColumnTypes,\n                    convert(icebergSchema, \"table\"),\n                    makeTypeMap(fileColumnTypes, fileColumnNames),\n                    parquetWriterOptions,\n                    IntStream.range(0, fileColumnNames.size()).toArray(),\n                    getCompressionCodec(session).getParquetCompressionCodec(),\n                    outputPath,\n                    hdfsEnvironment,\n                    hdfsContext,\n                    metricsConfig,\n                    writerTimezone,\n                    nodeVersion.toString());\n        }\n        catch (IOException e) {\n            throw new PrestoException(ICEBERG_WRITER_OPEN_ERROR, \"Error creating Parquet file\", e);\n        }\n    }\n\n    private IcebergFileWriter createOrcWriter(\n            Path outputPath,\n            Schema icebergSchema,\n            JobConf jobConf,\n            ConnectorSession session)\n    {\n        try {\n            FileSystem fileSystem = hdfsEnvironment.getFileSystem(session.getUser(), outputPath, jobConf);\n            DataSink orcDataSink = hdfsEnvironment.doAs(session.getUser(), () -> new OutputStreamDataSink(fileSystem.create(outputPath)));\n            Callable<Void> rollbackAction = () -> {\n                hdfsEnvironment.doAs(session.getUser(), () -> fileSystem.delete(outputPath, false));\n                return null;\n            };\n\n            List<Types.NestedField> columnFields = icebergSchema.columns();","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergFileWriterFactory.java#L160-L196","documentation":"Wraps an IOException thrown while opening/creating a Parquet writer in IcebergFileWriterFactory.createParquetWriter. The failure happens during file creation (path setup, filesystem access, Parquet schema/message-type construction or writer init), before any rows are written, and is rethrown as ICEBERG_WRITER_OPEN_ERROR.","triggerScenarios":"createFileWriter dispatches to createParquetWriter for a PARQUET table and the underlying HDFS/Parquet writer constructor throws IOException — bad output path, permission denied, missing filesystem credentials, or invalid schema for Parquet.","commonSituations":"Insufficient permissions or non-existent target directory in HDFS/S3, expired Kerberos/credentials, wrong writer timezone or node version config, or quota/disk-full conditions.","solutions":["Check the wrapped cause and target output path permissions/existence; ensure the write location is accessible","Verify filesystem credentials (Kerberos ticket, S3/ABFS keys or instance role) are valid and not expired","Confirm the target directory exists or the connector can create it, and storage quota/disk is not exhausted","Retry the query after fixing transient connectivity to the storage system"],"exampleFix":"// before\n-- writing to s3://bucket/missing-prefix/ with no s3 credentials configured\n// after\n-- configure hive.s3.aws-access-key/secret (or instance profile) and ensure the target directory is writable\nCREATE TABLE ... WITH (format='PARQUET', location='s3://bucket/valid-prefix/');","handlingStrategy":"try-catch","validationCode":"// verify the target location is writable before writing\nboolean ok = fs.exists(dir) ? fs.isDirectory(dir) && fs.access(dir, WRITE) : fs.mkdirs(dir);\nif (!ok) throw new IOException(\"Cannot write to \" + dir);","typeGuard":null,"tryCatchPattern":"try { /* run write query */ } catch (PrestoException e) { if (\"ICEBERG_WRITER_OPEN_ERROR\".equals(e.getErrorCode().getName())) { /* check e.getCause() IOException: fix path/permissions/credentials, then retry */ } else throw e; }","preventionTips":["Pre-create and pre-permission target directories","Keep Kerberos tickets and cloud credentials refreshed on workers","Monitor storage quota and disk space on target systems","Validate writer timezone config matches cluster expectations"],"tags":["iceberg","parquet","writer","io-exception","filesystem"],"backgroundTag":"writer-open-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"}