microg/GmsCore · error · NoSuchElementException

Cannot advance the iterator beyond

Error message

Cannot advance the iterator beyond 

What it means

Standard Iterator contract violation thrown in SingleRefDataBufferIterator.next when next() is called after hasNext() returned false — the iterator's position has reached the end of the DataBuffer. The current position is appended to the message.

Source

Thrown at play-services-base/src/main/java/com/google/android/gms/common/data/SingleRefDataBufferIterator.java:24

package com.google.android.gms.common.data;

import androidx.annotation.NonNull;
import org.microg.gms.common.Hide;

import java.util.NoSuchElementException;

@Hide
public class SingleRefDataBufferIterator<T> extends DataBufferIterator<T> {
    private T element;

    public SingleRefDataBufferIterator(@NonNull DataBuffer<T> dataBuffer) {
        super(dataBuffer);
    }

    @Override
    public T next() {
        if (!hasNext()) {
            throw new NoSuchElementException("Cannot advance the iterator beyond " + position);
        }
        ++position;
        if (position == 0) {
            element = dataBuffer.get(position);
            if (!(element instanceof DataBufferRef)) {
                throw new IllegalStateException("DataBuffer reference of type " + element.getClass() + " is not movable");
            }
        } else {
            ((DataBufferRef) element).setDataRow(position);
        }
        return element;
    }
}

View on GitHub (pinned to 157c9d86ac)

Solutions

  1. Guard iteration with hasNext() (or use a for-each loop) before calling next()
  2. Check the buffer's count before iterating beyond it
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at play-services-base/src/main/java/com/google/android/gms/common/data/SingleRefDataBufferIterator.java:24 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of microg/GmsCore@157c9d86ac (2026-09-06). Data as JSON: /api/errors/6fca9a7bc81cd8c8. Report an issue: GitHub.