apache/hadoop · error · NoSuchElementException

No more entry in " + f

Error message

No more entry in " + f

What it means

The legacy (mapred API) StreamXmlRecordReader reads records delimited by begin/end regex markers taken from job configuration. In its constructor init it calls checkJobGet('stream.recordreader.begin') and checkJobGet('stream.recordreader.end'); if either property is unset, job_.get(prop) returns null and checkJobGet throws IOException 'JobConf: missing required property'. It is a configuration-completeness guard: XML record reading cannot proceed without both markers.

Source

Thrown at hadoop-cloud-storage-project/hadoop-bos/src/main/java/org/apache/hadoop/fs/bos/BaiduBosFileSystem.java:168

      Progressable progress) throws IOException {
    throw new UnsupportedOperationException(
        "Append is not supported by BaiduBosFileSystem");
  }

  @Override
  public RemoteIterator<LocatedFileStatus> listLocatedStatus(
      final Path f, final PathFilter filter) throws IOException {
    return new RemoteIterator<LocatedFileStatus>() {
      private final FileStatus[] stats = listStatus(f, filter);
      private int i = 0;

      public boolean hasNext() {
        return i < stats.length;
      }

      public LocatedFileStatus next() throws IOException {
        if (!hasNext()) {
          throw new NoSuchElementException(
              "No more entry in " + f);
        }
        FileStatus result = stats[i++];
        BlockLocation[] locs = result.isFile()
            ? getFileBlockLocations(result, 0, result.getLen())
            : null;
        return new LocatedFileStatus(result, locs);
      }
    };
  }

  @Override
  public FSDataOutputStream create(Path f, FsPermission permission,
      boolean overwrite, int bufferSize, short replication,
      long blockSize, Progressable progress) throws IOException {
    Path absolutePath = makeAbsolute(f);
    String key = pathToKey(absolutePath);

View on GitHub (pinned to 2add963021)

Solutions

  1. Set both required properties, e.g. -jobconf stream.recordreader.begin='<page>' -jobconf stream.recordreader.end='</page>' on the streaming command line (or jobConf.set(...) for the mapred API).
  2. Verify exact key spelling: the reader reads CONF_NS + 'begin' / CONF_NS + 'end' where CONF_NS is 'stream.recordreader.'.
  3. If you intended plain line input, drop -inputreader StreamXmlRecordReader and use the default LineRecordReader.
  4. Fail fast locally: assert job.get('stream.recordreader.begin') != null before submitting the job.

Example fix

# before
-inputreader org.apache.hadoop.streaming.StreamXmlRecordReader

# after
-inputreader org.apache.hadoop.streaming.StreamXmlRecordReader \
 -jobconf stream.recordreader.begin='<record>' \
 -jobconf stream.recordreader.end='</record>'
Defensive patterns

Strategy: validation

Validate before calling

static void requireXmlReaderProps(JobConf job) {
  for (String k : new String[]{"stream.recordreader.begin", "stream.recordreader.end"}) {
    if (job.get(k) == null) throw new IllegalArgumentException("missing " + k);
  }
}

Prevention

When it happens

Trigger: Selecting StreamXmlRecordReader via -inputreader org.apache.hadoop.streaming.StreamXmlRecordReader (or stream.recordreader.class) without also setting stream.recordreader.begin and stream.recordreader.end in the job conf; init is invoked on the task side per split.

Common situations: Streaming jobs that read XML/character-delimited records and forget the two -jobconf flags; porting a job between clusters where a job.xml customization was dropped; setting the properties under a typo'd key name (e.g. stream.recordreader.start) so get() returns null.

Related errors


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/e483c9a7b9aaf3a4. Report an issue: GitHub.