{"record":{"id":"ccbcf4894d05e685","repo":"pinpoint-apm/pinpoint","slug":"illegalstateexception","errorCode":null,"errorMessage":"IllegalStateException","messagePattern":"IllegalStateException","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/concurrent/jsr166/ConcurrentReferenceHashMap.java","lineNumber":1497,"sourceCode":"            return false;\n        }\n\n        HashEntry<K,V> nextEntry() {\n            do {\n                if (nextEntry == null)\n                    throw new NoSuchElementException();\n\n                lastReturned = nextEntry;\n                currentKey = lastReturned.key();\n                advance();\n            } while (currentKey == null); // Skip GC'd keys\n\n            return lastReturned;\n        }\n\n        public void remove() {\n            if (lastReturned == null)\n                throw new IllegalStateException();\n            ConcurrentReferenceHashMap.this.remove(currentKey);\n            lastReturned = null;\n        }\n    }\n\n    final class KeyIterator\n            extends HashIterator\n            implements Iterator<K>, Enumeration<K>\n    {\n        public K next()        { return super.nextEntry().key(); }\n        public K nextElement() { return super.nextEntry().key(); }\n    }\n\n    final class ValueIterator\n            extends HashIterator\n            implements Iterator<V>, Enumeration<V>\n    {\n        public V next()        { return super.nextEntry().value(); }","sourceCodeStart":1479,"sourceCodeEnd":1515,"githubUrl":"https://github.com/pinpoint-apm/pinpoint/blob/744c3d3075e595656abb1ae331ad2c0e4c9eb996/commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/concurrent/jsr166/ConcurrentReferenceHashMap.java#L1479-L1515","documentation":"Sentinel guard in the HashEntry iterator's remove() of ConcurrentReferenceHashMap: it fires when remove() is called before next() has ever returned an element, or after remove() has already been invoked for the current element, so there is no valid lastReturned entry to delete. This is standard Iterator contract enforcement, not a data corruption signal. Callers must only call iterator.remove() once per element returned by next().","triggerScenarios":"Thrown at commons-profiler/src/main/java/com/navercorp/pinpoint/common/profiler/concurrent/jsr166/ConcurrentReferenceHashMap.java:1497 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Call next() before each remove()","Track removal state explicitly if conditional removal is needed"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"744c3d3075e595656abb1ae331ad2c0e4c9eb996","analyzedAt":"2026-09-07T18:48:45.289Z","contentChangedAt":"2026-09-07T18:48:45.289Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}