{"record":{"id":"1f29b45479bbdcb2","repo":"oracle/graal","slug":"unbalanced-groups","errorCode":null,"errorMessage":"Unbalanced groups","messagePattern":"Unbalanced groups","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/BinaryReader.java","lineNumber":876,"sourceCode":"            }\n\n        }\n        return builder.rootDocument();\n    }\n\n    protected void beginGroup() throws IOException {\n        parseGroup();\n        folderLevel++;\n        hashStack.push(null);\n        // note: startGroupContent MAY throw SkipRootException; but unlike graph\n        // group contains root terminator byte, which will be read by parseRoot()\n        // immediately after.\n        builder.startGroupContent();\n    }\n\n    private void doCloseGroup() throws IOException {\n        if (folderLevel-- == 0) {\n            throw new IOException(\"Unbalanced groups\");\n        }\n        builder.endGroup();\n        hashStack.pop();\n        reporter.popContext();\n    }\n\n    protected void parseRoot() throws IOException {\n        try {\n            builder.startRoot();\n            int type = dataSource.readByte();\n            // startRoot may also throw SkipRootException\n            switch (type) {\n                case BEGIN_GRAPH: {\n                    parseGraph();\n                    break;\n                }\n                case BEGIN_GROUP: {\n                    beginGroup();","sourceCodeStart":858,"sourceCodeEnd":894,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/graphio/parsing/BinaryReader.java#L858-L894","documentation":"BinaryReader tracks folderLevel as BEGIN_GROUP/CLOSE_GROUP entries pair up; doCloseGroup decrements it and throws IOException('Unbalanced groups') when it was already 0, i.e. the stream contains a CLOSE_GROUP root entry with no open group. This indicates malformed group nesting: corrupted bytes, a hand-built stream, or a writer bug that emitted an extra group terminator.","triggerScenarios":"A CLOSE_GROUP root-level entry appearing before any BEGIN_GROUP; truncation/corruption shifting root-entry tags; custom producers that write group terminators without matching group starts.","commonSituations":"Viewing damaged or hand-assembled dump files; interrupted dumps that were partially repaired; producer forks with incorrect group nesting logic.","solutions":["Regenerate the dump with a stock producer and retry.","Verify the file's structural integrity (root-entry sequence should begin with BEGIN_GROUP or GRAPH entries only).","If writing a custom producer, ensure every CLOSE_GROUP is paired with exactly one preceding BEGIN_GROUP."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { reader.parse(); } catch (IOException e) { if (\"Unbalanced groups\".equals(e.getMessage())) { /* malformed nesting: regenerate dump */ } }","preventionTips":["In custom writers, pair every BEGIN_GROUP with exactly one CLOSE_GROUP.","Do not hand-edit or splice group sections of dumps.","Regenerate dumps from a stock producer when nesting errors appear."],"tags":["graphio","parsing","groups","corrupt-input"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}