apache/flink · critical · RuntimeException

Error while waiting for job to be initialized

Error message

Error while waiting for job to be initialized

What it means

Thrown while initializing a Parquet DataPageV2 for a column in Flink's vectorized Parquet reader (AbstractColumnReader.readPageV2). The wrapper IOException means prepareNewPage failed while setting up the data decoder for the page body — the cause (nested exception) carries the real reason, such as a truncated stream, an unsupported encoding, or a missing dictionary. It indicates the column chunk's page data cannot be decoded with the page's declared data encoding.

Source

Thrown at flink-clients/src/main/java/org/apache/flink/client/ClientUtils.java:185

            while (status == JobStatus.INITIALIZING) {
                Thread.sleep(waitStrategy.sleepTime(attempt++));
                status = jobStatusSupplier.get();
            }
            if (status == JobStatus.FAILED) {
                JobResult result = jobResultSupplier.get();
                Optional<SerializedThrowable> throwable = result.getSerializedThrowable();
                if (throwable.isPresent()) {
                    Throwable t = throwable.get().deserializeError(userCodeClassloader);
                    if (t instanceof JobInitializationException) {
                        throw t;
                    }
                }
            }
        } catch (JobInitializationException initializationException) {
            throw initializationException;
        } catch (Throwable throwable) {
            ExceptionUtils.checkInterrupted(throwable);
            throw new RuntimeException("Error while waiting for job to be initialized", throwable);
        }
    }

    /**
     * The client reports the heartbeat to the dispatcher for aliveness.
     *
     * @param jobClient The job client.
     * @param interval The heartbeat interval.
     * @param timeout The heartbeat timeout.
     * @return The ScheduledExecutorService which reports heartbeat periodically.
     */
    public static ScheduledExecutorService reportHeartbeatPeriodically(
            JobClient jobClient, long interval, long timeout) {
        checkArgument(
                interval < timeout,
                "The client's heartbeat interval "
                        + "should be less than the heartbeat timeout. Please adjust the param '"
                        + ClientOptions.CLIENT_HEARTBEAT_INTERVAL

View on GitHub (pinned to 2f3c205e92)

Solutions

  1. Inspect the nested cause exception — the fix depends entirely on whether it is 'dictionary was missing', 'Unsupported encoding', or a stream EOF
  2. Verify file integrity: re-download/regenerate the file and compare length/CRC; run `parquet-tools meta/dump` on it to confirm page structure is valid
  3. If the cause is an unsupported encoding, rewrite the file with a standard writer (e.g. parquet-mr defaults: PLAIN / PLAIN_DICTIONARY / RLE_DICTIONARY) or read it through a path that does not use the vectorized reader
  4. Reproduce with the same file in parquet-mr's VerifyAndWrite / dump tool to determine whether the defect is in the file or in Flink's reader

Example fix

// No code fix — data-side issue.
// Diagnose with the cause:
} catch (IOException e) {
    Throwable root = ExceptionUtils.getRootCause(e);
    // root tells you: dictionary missing / unsupported encoding / EOF
}
Defensive patterns

Strategy: try-catch

Validate before calling

// Before reading, sanity-check page structure with parquet-mr metadata
ParquetFileReader reader = ParquetFileReader.open(conf, path);
ParquetMetadata md = reader.getFooter();
for (ColumnChunkMetaData cc : md.getBlocks().get(0).getColumns()) {
    // pages for the chunk can be inspected via reader.readNextChunk()/getPageIndex
    // reject files whose encodings are unknown to Encoding.values()
}

Try / catch

try {
    vectorizedReader.readToVector(n, vector);
} catch (IOException e) {
    // 'could not read page ... in col ...' — inspect root cause before retry
    Throwable cause = ExceptionUtils.getRootCause(e);
    LOG.error("Parquet page decode failed for {}", descriptor, cause);
    throw e; // never blind-retry: corruption is deterministic per file
}

Prevention

When it happens

Trigger: Reading a Parquet file whose DataPageV2 body is corrupt or truncated; the page declares an encoding prepareNewPage rejects (see the dictionary-missing and unsupported-encoding branches it calls); a dictionary-encoded page arriving when the dictionary page was never read for that column chunk; partial file writes or bad transfers producing short page byte arrays.

Common situations: Ingesting Parquet files produced by non-standard writers or writers with experimental v2 pages; files corrupted in object-store transfer or truncated uploads; files where column chunks are written with encodings Flink's vectorized reader does not implement; upgrading a writer library that changed default page encodings.

Related errors


AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14). Data as JSON: /api/errors/6b5b25fafff34ccb. Report an issue: GitHub.