{"record":{"id":"e3310098de3529c1","repo":"oracle/graal","slug":"error-disassembling-s-npartial-disassembly-n-s","errorCode":null,"errorMessage":"Error disassembling %s%nPartial disassembly:%n%s","messagePattern":"Error disassembling (.+?)%nPartial disassembly:%n(.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/bytecode/BytecodeDisassembler.java","lineNumber":252,"sourceCode":"                        buf.append(String.format(\"%4d: %-14s\", bci, mnemonic));\n                    } else {\n                        buf.append(bci).append(' ').append(mnemonic);\n                    }\n                    if (stream.nextBCI() > bci + 1) {\n                        if (!format) {\n                            buf.append(' ');\n                        }\n                        decodeOperand(buf, stream, cp, method, bci, opcode);\n                    }\n                    if (newLine != null) {\n                        buf.append(newLine);\n                    }\n                }\n                stream.next();\n                opcode = stream.currentBC();\n            }\n        } catch (Throwable e) {\n            throw new RuntimeException(String.format(\"Error disassembling %s%nPartial disassembly:%n%s\", method.format(\"%H.%n(%p)\"), buf.toString()), e);\n        }\n        return buf.toString();\n    }\n\n    private void decodeOperand(StringBuilder buf, BytecodeStream stream, ConstantPool cp, ResolvedJavaMethod method, int bci, int opcode) {\n        // @formatter:off\n        switch (opcode) {\n            case BIPUSH         : buf.append(stream.readByte()); break;\n            case SIPUSH         : buf.append(stream.readShort()); break;\n            case NEW            :\n            case CHECKCAST      :\n            case INSTANCEOF     :\n            case ANEWARRAY      : {\n                int cpi = stream.readCPI();\n                JavaType type = cp.lookupType(cpi, opcode);\n                cpi = cpiFunction.apply(opcode, cpi);\n                if (format) {\n                    buf.append(String.format(\"#%-10d // %s\", cpi, type.toJavaName()));","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/bytecode/BytecodeDisassembler.java#L234-L270","documentation":"BytecodeDisassembler.disassemble wraps its whole decoding loop in a try/catch (Throwable) and rethrows a RuntimeException carrying the method descriptor plus the partial disassembly produced so far. Any failure while decoding an instruction or resolving a constant-pool operand (index out of range, unsupported opcode, malformed CP entry) is reported this way, with the original cause chained.","triggerScenarios":"Calling disassemble(method) on a ResolvedJavaMethod whose bytecode or constant pool is malformed or unexpected: bad CPI indices in operands, a tool (obfuscator/instrumentation agent) writing non-standard bytecode, or a disassembler gap for a newly added JVM instruction. The partial buffer in the message shows decoding progressed up to the failing BCI.","commonSituations":"Dumping bytecode during Graal debugging (-Dgraal.Dump triggers disassembly), disassembling classes processed by coverage tools, obfuscators, or ASM-based agents, or running a Graal build older than the JDK that produced the class files (new bytecodes). Frequently co-occurs with error 21's bridge scanning, which disassembles bridges.","solutions":["Read the chained cause (e.getCause()) — it names the actual decoding failure (e.g. ConstantPoolError, IndexOutOfBounds) and points at the failing instruction.","Disassemble the same class with javap -c or javap -v to confirm whether the class file itself is malformed; if javap also fails, the producer (obfuscator/agent) is at fault.","If javap succeeds, report a Graal issue with the method descriptor and partial disassembly from the message.","Upgrade Graal to a version matching the JDK's bytecode level if the class uses recently introduced instructions."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    String dis = new BytecodeDisassembler().disassemble(method);\n} catch (RuntimeException e) {\n    if (e.getCause() != null) {\n        LOG.warn(\"Disassembly failed at cause: {}\", e.getCause());\n    }\n    // fall back to javap-style output or skip\n}","preventionTips":["Treat disassembly as best-effort tooling: never let its failure fail a compilation or production path.","Pre-validate class files with a bytecode checker (ASM CheckClassAdapter) before disassembling untrusted input."],"tags":["disassembler","bytecode","constant-pool","runtime-exception","debugging"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}