prestodb/presto · error · PrestoException
HIVE_WRITER_CLOSE_ERROR
HIVE_WRITER_CLOSE_ERROR
Error message
Error committing write to Hive
What it means
RecordFileWriter.commit() closes the underlying Hive RecordWriter to finalize the output file. If closing throws an IOException, the failure is wrapped in HIVE_WRITER_CLOSE_ERROR with this message. The output file could not be finalized and the write should be treated as failed.
Source
Thrown at presto-hive/src/main/java/com/facebook/presto/hive/RecordFileWriter.java:194
try {
recordWriter.write(serializer.serialize(row, tableInspector));
}
catch (SerDeException | IOException e) {
throw new PrestoException(HIVE_WRITER_DATA_ERROR, e);
}
}
@Override
public Optional<Page> commit()
{
try {
recordWriter.close(false);
committed = true;
return Optional.empty();
}
catch (IOException e) {
throw new PrestoException(HIVE_WRITER_CLOSE_ERROR, "Error committing write to Hive", e);
}
}
@Override
public void rollback()
{
try {
try {
recordWriter.close(true);
}
finally {
// perform explicit deletion here as implementations of RecordWriter.close() often ignore the abort flag.
path.getFileSystem(conf).delete(path, false);
}
}
catch (IOException e) {
throw new PrestoException(HIVE_WRITER_CLOSE_ERROR, "Error rolling back write to Hive", e);
}View on GitHub (pinned to 55bb57d202)
Solutions
- Retry the query after confirming HDFS is healthy — most causes are transient I/O faults.
- Inspect the wrapped IOException to find the storage-level problem (quota, DataNode, permissions).
- Check remaining HDFS quota and repair the write path if files were left in staging.
- If a custom RecordWriter/InputFormat is in use, verify its close() implementation is correct.
Defensive patterns
Strategy: retry
Try / catch
try {
executeInsert(sql);
} catch (PrestoException e) {
if (e.getErrorCode() == HiveErrorCode.HIVE_WRITER_CLOSE_ERROR.toErrorCode().getId()
&& e.getCause() instanceof IOException) {
// verify HDFS health then retry; clean up staging leftovers
}
} Prevention
- Ensure HDFS quota and disk headroom before large record-file writes.
- Avoid concurrent maintenance (node restarts, decommissions) during INSERTs.
- Audit custom RecordWriter implementations for correct close() behavior.
When it happens
Trigger: recordWriter.close(false) throwing IOException at the end of an INSERT using a record-based format (TextFile/SequenceFile etc.) — usually an I/O failure flushing final bytes to HDFS.
Common situations: HDFS DataNode loss or network error during the final flush; disk full/quota at commit time; buggy custom RecordWriter implementations that throw on close; long-running writes hitting a cluster change (restart, decommission).
Related errors
- HIVE_WRITER_CLOSE_ERROR
- HIVE_WRITER_CLOSE_ERROR
- HIVE_WRITER_CLOSE_ERROR
- HIVE_FILESYSTEM_ERROR
- HIVE_FILESYSTEM_ERROR
AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04).
Data as JSON: /api/errors/1dfd1400bcb137b8.
Report an issue: GitHub.