apache/flink · critical · FlinkException
Could not cancel job {}.
Error message
Could not cancel job {}. What it means
Thrown from AbstractColumnReader.readDataBuffer when slicing `length` bytes from the page's data stream fails — i.e. the page has fewer remaining bytes than the fixed-width value being read requires. The message states exactly how many bytes were requested. This is a page-body truncation invariant violation.
Source
Thrown at flink-clients/src/main/java/org/apache/flink/client/cli/CliFrontend.java:670
+ targetDirectory
+ '.');
}
runClusterAction(
activeCommandLine,
commandLine,
(clusterClient, effectiveConfiguration) -> {
final String savepointPath;
try {
savepointPath =
clusterClient
.cancelWithSavepoint(jobId, targetDirectory, formatType)
.get(
getClientTimeout(effectiveConfiguration)
.toMillis(),
TimeUnit.MILLISECONDS);
} catch (Exception e) {
throw new FlinkException("Could not cancel job " + jobId + '.', e);
}
logAndSysout(
"Cancelled job "
+ jobId
+ ". Savepoint stored in "
+ savepointPath
+ '.');
});
} else {
final JobID jobId;
if (cleanedArgs.length > 0) {
jobId = parseJobId(cleanedArgs[0]);
} else {
throw new CliArgsException("Missing JobID. Specify a JobID to cancel a job.");
}
logAndSysout("Cancelling job " + jobId + '.');View on GitHub (pinned to 2f3c205e92)
Solutions
- Compare the requested length in the message with the page size — a fixed-width read exceeding remaining bytes proves page truncation
- Re-obtain the file and verify its size/CRC; retry read on a clean copy
- Dump the column chunk with `parquet-tools dump -c <column>` to confirm the page layout in a reference reader
- If reproducible, the writer produced invalid pages — capture the file and report to the writer's project
Defensive patterns
Strategy: validation
Validate before calling
// Before reading fixed-length types, confirm page byte counts from metadata
ColumnChunkMetaData cc = ...;
int typeLen = cc.getType() == PrimitiveType.PrimitiveTypeName.FIXED_LEN_BYTE_ARRAY
? cc.getTypeLength() : cc.getType().byteSize();
// page sizes live in the page index / column index when present; absent them,
// rely on footer-consistency checks: encodings + total size must be coherent Try / catch
try {
vectorizedReader.readToVector(...);
} catch (ParquetDecodingException e) {
if (String.valueOf(e.getMessage()).startsWith("Failed to read")) {
quarantine(file); // deterministic truncation
} else throw e;
} Prevention
- Verify content-length/ETag after uploading/downloading Parquet files
- Use page-index-enabled writers so truncation is detectable from metadata
- Never retry this error unchanged — it is deterministic per file
When it happens
Trigger: Reading FIXED_LEN_BYTE_ARRAY (e.g. DECIMAL, INT96 timestamps) or fixed-width values where the remaining page bytes < value length; page metadata count/values inconsistent with actual page size; corrupted page bytes.
Common situations: Truncated files in object storage; writers with bugs emitting short pages for fixed-length types; decimal(38,x) or INT96 timestamp columns in malformed files.
Related errors
- Error while waiting for job to be initialized
- Could not build the program from JAR file: {}
- Missing JobID. Specify a JobID to cancel a job.
- Failed to dispose the savepoint '{}'.
- Failed to read from input stream
AI-assisted analysis of apache/flink@2f3c205e92 (2026-08-14).
Data as JSON: /api/errors/08ef92294b437553.
Report an issue: GitHub.