apache/hadoop · error · IOException
Fixed record length {} is invalid. It should be set to a va
Error message
Fixed record length {} is invalid. It should be set to a value greater than zero What it means
Error "Fixed record length {} is invalid. It should be set to a value greater than zero" thrown in apache/hadoop.
Source
Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/FixedLengthInputFormat.java:84
* @return the record length, zero means none was set
*/
public static int getRecordLength(Configuration conf) {
return conf.getInt(FIXED_RECORD_LENGTH, 0);
}
@Override
public void configure(JobConf conf) {
compressionCodecs = new CompressionCodecFactory(conf);
}
@Override
public RecordReader<LongWritable, BytesWritable>
getRecordReader(InputSplit genericSplit, JobConf job, Reporter reporter)
throws IOException {
reporter.setStatus(genericSplit.toString());
int recordLength = getRecordLength(job);
if (recordLength <= 0) {
throw new IOException("Fixed record length " + recordLength
+ " is invalid. It should be set to a value greater than zero");
}
return new FixedLengthRecordReader(job, (FileSplit)genericSplit,
recordLength);
}
@Override
protected boolean isSplitable(FileSystem fs, Path file) {
final CompressionCodec codec = compressionCodecs.getCodec(file);
return(null == codec);
}
}
View on GitHub (pinned to 2add963021)
Solutions
- Set mapreduce.input.fixedlengthinputformat.record.length to a positive integer greater than zero.
When it happens
Trigger: Thrown at hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/FixedLengthInputFormat.java:84 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22).
Data as JSON: /api/errors/c20c55dabc2bc620.
Report an issue: GitHub.