oracle/graal · error · InternalError

Malformed HexCodeFile in

Error message

Malformed HexCodeFile in 

What it means

HexCodeFileDis throws this InternalError when HexCodeFile.parse returns null for an embedded code block it extracted from a larger document. Like the DisassemblerTool variant, it means the text between the start/end delimiters failed HexCodeFile parsing; the InternalError (vs IllegalArgumentException) signals it fires inside the library's own processing loop rather than at a CLI boundary. The named input file identifies which document contained the bad block.

Source

Thrown at compiler/src/jdk.graal.compiler.test/src/jdk/graal/compiler/disassembler/HexCodeFileDis.java:103

            int codeStart = index + startDelim.length();

            String copy = input.substring(codeEnd, codeStart);
            if (copy.startsWith(endDelim)) {
                copy = copy.substring(endDelim.length());
            }
            if (copy.endsWith(startDelim)) {
                copy = copy.substring(0, copy.length() - startDelim.length());
            }
            out.println(copy);

            int endIndex = input.indexOf(endDelim, codeStart);
            assert endIndex != -1;

            String source = input.substring(codeStart, endIndex);

            HexCodeFile hcf = HexCodeFile.parse(input, codeStart, source, inputName);
            if (hcf == null) {
                throw new InternalError("Malformed HexCodeFile in " + inputName);
            }
            process(hcf, out);
            hcfCount++;
            codeEnd = endIndex;
        }

        String copy = input.substring(codeEnd);
        if (copy.startsWith(endDelim)) {
            copy = copy.substring(endDelim.length());
        }

        System.out.println(inputName + ": disassembled " + hcfCount + " embedded HexCodeFiles");
        out.print(copy);
        out.flush();
        return baos.toString();
    }

    /**

View on GitHub (pinned to a66e9ccd1d)

Solutions

  1. Locate the offending block in the named file (search for the start delimiter) and fix or delete the malformed lines.
  2. Reproduce with DisassemblerTool on the same file to see which block index fails, then isolate it.
  3. Regenerate the dump with the same GraalVM version as the disassembler library.
  4. If processing many files, wrap per-file processing so one bad block does not stop the batch.

Example fix

// before
new HexCodeFileDis(showComments, showBytes).processFile(corruptFile);
// after (batch hardening)
for (Path f : files) {
    try {
        new HexCodeFileDis(showComments, showBytes).processFile(f);
    } catch (InternalError e) {
        System.err.println("skipping " + f + ": " + e.getMessage());
    }
}
Defensive patterns

Strategy: try-catch

Try / catch

for (Path f : files) {
    try { new HexCodeFileDis(false, false).process(f.toFile()); }
    catch (InternalError e) { log.warning("skipping " + f + ": " + e.getMessage()); }
}

Prevention

When it happens

Trigger: Calling the HexCodeFileDis processing API on a file where an embedded block (between startDelim and endDelim) has malformed hex content, inconsistent comment columns, or where an assert-protected indexOf(endDelim) region ends up containing unparseable text. hcf == null from HexCodeFile.parse triggers the throw.

Common situations: Batch-disassembling compiler test output or hs_err-style logs that contain embedded hex code sections; a single corrupt or foreign-format block aborts the whole run. Version skew between the producer of the dump and this parser, or hand-merged log files, are typical causes.

Understand the failure class

Related errors


AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14). Data as JSON: /api/errors/bc94c3a39f599ef8. Report an issue: GitHub.