prestodb/presto · error · PrestoException

HIVE_WRITER_CLOSE_ERROR

HIVE_WRITER_CLOSE_ERROR

Error message

Error committing write to Hive

What it means

RcFileFileWriter.commit() finishes the RCFile writer and runs its rollback cleanup if committing fails. Any exception while closing/committing the underlying RCFile (or running the commit action) is wrapped in HIVE_WRITER_CLOSE_ERROR with this message. The query's output files could not be finalized; the write is rolled back.

Source

Thrown at presto-hive/src/main/java/com/facebook/presto/hive/RcFileFileWriter.java:145

        catch (IOException | UncheckedIOException e) {
            throw new PrestoException(HIVE_WRITER_DATA_ERROR, e);
        }
    }

    @Override
    public Optional<Page> commit()
    {
        try {
            rcFileWriter.close();
        }
        catch (IOException | UncheckedIOException e) {
            try {
                rollbackAction.call();
            }
            catch (Exception ignored) {
                // ignore
            }
            throw new PrestoException(HIVE_WRITER_CLOSE_ERROR, "Error committing write to Hive", e);
        }

        if (validationInputFactory.isPresent()) {
            try {
                try (RcFileDataSource input = validationInputFactory.get().get()) {
                    long startThreadCpuTime = THREAD_MX_BEAN.getCurrentThreadCpuTime();
                    rcFileWriter.validate(input);
                    validationCpuNanos += THREAD_MX_BEAN.getCurrentThreadCpuTime() - startThreadCpuTime;
                }
            }
            catch (IOException | UncheckedIOException e) {
                throw new PrestoException(HIVE_WRITE_VALIDATION_FAILED, e);
            }
        }
        return Optional.empty();
    }

    @Override

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Retry the query; many causes (HDFS blips) are transient.
  2. Inspect the wrapped cause (DataNode/disk/quota errors) and fix the storage issue.
  3. Check HDFS health, remaining quota, and NameNode connectivity for the write path.
  4. If it recurs on the same data, validate the RCFile writer configuration and table format compatibility.
Defensive patterns

Strategy: retry

Try / catch

try {
    executeInsert(sql);
} catch (PrestoException e) {
    if (e.getErrorCode() == HiveErrorCode.HIVE_WRITER_CLOSE_ERROR.toErrorCode().getId()) {
        // log the wrapped cause (getCause()) and retry after verifying HDFS health
    }
}

Prevention

When it happens

Trigger: An IOException or runtime error while the RCFile writer flushes/closes its file during commit(), e.g. HDFS write failure, node loss, quota exceeded, or a failure inside the commit path itself.

Common situations: HDFS DataNode failures or full disks on the write path mid-commit; network partitions to HDFS during close; transient cluster instability at the end of a long INSERT.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/918cb6a09c6e681a. Report an issue: GitHub.