{"record":{"id":"918cb6a09c6e681a","repo":"prestodb/presto","slug":"hive-writer-close-error-918cb6","errorCode":"HIVE_WRITER_CLOSE_ERROR","errorMessage":"Error committing write to Hive","messagePattern":"Error committing write to Hive","errorType":"error_code","errorClass":"PrestoException","httpStatus":null,"severity":"error","filePath":"presto-hive/src/main/java/com/facebook/presto/hive/RcFileFileWriter.java","lineNumber":145,"sourceCode":"        catch (IOException | UncheckedIOException e) {\n            throw new PrestoException(HIVE_WRITER_DATA_ERROR, e);\n        }\n    }\n\n    @Override\n    public Optional<Page> commit()\n    {\n        try {\n            rcFileWriter.close();\n        }\n        catch (IOException | UncheckedIOException e) {\n            try {\n                rollbackAction.call();\n            }\n            catch (Exception ignored) {\n                // ignore\n            }\n            throw new PrestoException(HIVE_WRITER_CLOSE_ERROR, \"Error committing write to Hive\", e);\n        }\n\n        if (validationInputFactory.isPresent()) {\n            try {\n                try (RcFileDataSource input = validationInputFactory.get().get()) {\n                    long startThreadCpuTime = THREAD_MX_BEAN.getCurrentThreadCpuTime();\n                    rcFileWriter.validate(input);\n                    validationCpuNanos += THREAD_MX_BEAN.getCurrentThreadCpuTime() - startThreadCpuTime;\n                }\n            }\n            catch (IOException | UncheckedIOException e) {\n                throw new PrestoException(HIVE_WRITE_VALIDATION_FAILED, e);\n            }\n        }\n        return Optional.empty();\n    }\n\n    @Override","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive/src/main/java/com/facebook/presto/hive/RcFileFileWriter.java#L127-L163","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the query; many causes (HDFS blips) are transient.","Inspect the wrapped cause (DataNode/disk/quota errors) and fix the storage issue.","Check HDFS health, remaining quota, and NameNode connectivity for the write path.","If it recurs on the same data, validate the RCFile writer configuration and table format compatibility."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    executeInsert(sql);\n} catch (PrestoException e) {\n    if (e.getErrorCode() == HiveErrorCode.HIVE_WRITER_CLOSE_ERROR.toErrorCode().getId()) {\n        // log the wrapped cause (getCause()) and retry after verifying HDFS health\n    }\n}","preventionTips":["Monitor HDFS health (DataNode availability, disk space, quota) before large writes.","Avoid decommissioning nodes or restarting services during long-running INSERTs.","Set alerts for HDFS write-path errors on your ETL cluster."],"tags":["hive","rcfile","writer","commit","io"],"backgroundTag":"writer-close-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"}