{"record":{"id":"6fca9a7bc81cd8c8","repo":"microg/GmsCore","slug":"cannot-advance-the-iterator-beyond-6fca9a","errorCode":null,"errorMessage":"Cannot advance the iterator beyond ","messagePattern":"Cannot advance the iterator beyond ","errorType":"exception","errorClass":"NoSuchElementException","httpStatus":null,"severity":"error","filePath":"play-services-base/src/main/java/com/google/android/gms/common/data/SingleRefDataBufferIterator.java","lineNumber":24,"sourceCode":"package com.google.android.gms.common.data;\n\nimport androidx.annotation.NonNull;\nimport org.microg.gms.common.Hide;\n\nimport java.util.NoSuchElementException;\n\n@Hide\npublic class SingleRefDataBufferIterator<T> extends DataBufferIterator<T> {\n    private T element;\n\n    public SingleRefDataBufferIterator(@NonNull DataBuffer<T> dataBuffer) {\n        super(dataBuffer);\n    }\n\n    @Override\n    public T next() {\n        if (!hasNext()) {\n            throw new NoSuchElementException(\"Cannot advance the iterator beyond \" + position);\n        }\n        ++position;\n        if (position == 0) {\n            element = dataBuffer.get(position);\n            if (!(element instanceof DataBufferRef)) {\n                throw new IllegalStateException(\"DataBuffer reference of type \" + element.getClass() + \" is not movable\");\n            }\n        } else {\n            ((DataBufferRef) element).setDataRow(position);\n        }\n        return element;\n    }\n}\n","sourceCodeStart":6,"sourceCodeEnd":38,"githubUrl":"https://github.com/microg/GmsCore/blob/157c9d86ac46c195a86c2f15ab55c84036223f95/play-services-base/src/main/java/com/google/android/gms/common/data/SingleRefDataBufferIterator.java#L6-L38","documentation":"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.","triggerScenarios":"Thrown at play-services-base/src/main/java/com/google/android/gms/common/data/SingleRefDataBufferIterator.java:24 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Guard iteration with hasNext() (or use a for-each loop) before calling next()","Check the buffer's count before iterating beyond it"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"157c9d86ac46c195a86c2f15ab55c84036223f95","analyzedAt":"2026-09-06T17:27:33.892Z","contentChangedAt":"2026-09-06T17:27:33.892Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}