apache/hadoop · error · NoSuchElementException

No more results in listing of <listPath>

Error message

No more results in listing of <listPath>

What it means

Error "No more results in listing of <listPath>" thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java:660

     * remote IO. For later requests, S3 will be queried, hence the calls
     * may block or fail.
     * @return the next object listing.
     * @throws IOException if a query made of S3 fails.
     * @throws NoSuchElementException if there is no more data to list.
     */
    @Override
    @Retries.RetryTranslated
    public S3ListResult next() throws IOException {
      if (firstListing) {
        // clear the firstListing flag for future calls.
        firstListing = false;
        // Calculating the result of last async list call.
        objects = onceInTheFuture("listObjects()", listPath.toString(), s3ListResultFuture);
        fetchNextBatchAsyncIfPresent();
      } else {
        if (objectsPrev!= null && !objectsPrev.isTruncated()) {
          // nothing more to request: fail.
          throw new NoSuchElementException("No more results in listing of "
              + listPath);
        }
        // Calculating the result of last async list call.
        objects = onceInTheFuture("listObjects()", listPath.toString(), s3ListResultFuture);
        // Requesting next batch of results.
        fetchNextBatchAsyncIfPresent();
        listingCount++;
        LOG.debug("New listing status: {}", this);
      }
      // Storing the current result to be used by hasNext() call.
      objectsPrev = objects;
      return objectsPrev;
    }

    /**
     * If there are more listings present, call for next batch async.
     */
    private void fetchNextBatchAsyncIfPresent() {

View on GitHub (pinned to 2add963021)

Solutions

  1. This is an internal listing-exhaustion signal; do not call next on an exhausted listing iterator.

When it happens

Trigger: Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/Listing.java:660 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/8193844bcc5dd045. Report an issue: GitHub.