prestodb/presto · error · OrcCorruptionException

Validation failed

Error message

Validation failed

What it means

validateFile reads all stripes/batches back to verify a written file against an OrcWriteValidation. Any IOException during that full read means the file could not be read as written, wrapped as OrcCorruptionException("Validation failed").

Source

Thrown at presto-orc/src/main/java/com/facebook/presto/orc/OrcReader.java:518

                    false,
                    dwrfEncryptionProvider,
                    dwrfKeyProvider,
                    new RuntimeStats(),
                    Optional.empty(),
                    MODIFICATION_TIME_NOT_SET);
            try (OrcBatchRecordReader orcRecordReader = orcReader.createBatchRecordReader(
                    readTypes.build(),
                    OrcPredicate.TRUE,
                    hiveStorageTimeZone,
                    NOOP_ORC_AGGREGATED_MEMORY_CONTEXT,
                    INITIAL_BATCH_SIZE)) {
                while (orcRecordReader.nextBatch() >= 0) {
                    // ignored
                }
            }
        }
        catch (IOException e) {
            throw new OrcCorruptionException(e, input.getId(), "Validation failed");
        }
    }

    public static void validateWrite(Optional<OrcWriteValidation> writeValidation, OrcDataSource orcDataSource, Predicate<OrcWriteValidation> test, String messageFormat, Object... args)
            throws OrcCorruptionException
    {
        if (writeValidation.isPresent() && !test.test(writeValidation.get())) {
            throw new OrcCorruptionException(orcDataSource.getId(), "Write validation failed: " + messageFormat, args);
        }
    }

    public OrcDataSource getOrcDataSource()
    {
        return orcDataSource;
    }

    public StripeFooter readStripeFooter(StripeInformation stripe)
            throws IOException

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Read the chained IOException cause for the underlying I/O problem
  2. Check the storage/disk health and free space
  3. Rewrite the ORC file and re-run validation
  4. Verify file completeness (size/checksum) against the writer's expectations
Defensive patterns

Strategy: retry

Validate before calling

// pre-write: ensure sufficient disk space for the target file
if (fs.getUsed() + estimatedSize > fs.getCapacity() * 0.9) { throw new IOException("insufficient space"); }

Try / catch

try { OrcReader.validateFile(...); }
catch (OrcCorruptionException e) {
    if (e.getCause() instanceof IOException) { /* retry write once on fresh path, else alert */ }
}

Prevention

When it happens

Trigger: OrcReader.validateFile invoked after a write with write validation enabled, and orcRecordReader.nextBatch() throws IOException mid-read (truncated data, bad checksum, I/O failure).

Common situations: Disk full/IO errors during write leaving a truncated file, storage layer corruption, network filesystem glitches, concurrent modification of the file during validation.

Related errors


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