oracle/graal · error · ExperimentParserError
Failed to parse experiment {experimentId} in {resource}: {me
Error message
Failed to parse experiment {experimentId} in {resource}: {message} What it means
ExperimentJSONParser.parse wraps any JsonParserException raised while parsing a whole file's JSON into ExperimentParserError, carrying the experiment id, the file's symbolic path, and the parser's position-tagged message. It means the file is not syntactically valid JSON at all (as opposed to a type mismatch inside valid JSON).
Source
Thrown at compiler/src/org.graalvm.profdiff/src/org/graalvm/profdiff/parser/ExperimentJSONParser.java:180
*/
private final FileView file;
public ExperimentJSONParser(ExperimentId experimentId, FileView file) {
this.experimentId = experimentId;
this.file = file;
}
/**
* Parses the source string as a JSON literal.
*
* @return the parsed JSON literal
* @throws ExperimentParserError failed to parse the experiment
*/
public JSONLiteral parse() throws ExperimentParserError, IOException {
try {
return new JSONLiteral(new JsonParser(file.readFully()).parse(), null);
} catch (JsonParserException parserException) {
throw new ExperimentParserError(experimentId, file.getSymbolicPath(), parserException.getMessage());
}
}
/**
* Parses the source string as a JSON map using a list of allowed keys. It is assumed that the
* source string comes from the assigned file view.
*
* @param allowedKeys the list of allowed keys
* @param source the source string containing the JSON map
* @return the parsed JSON map containing only values for (not necessarily all) allowed keys
* @throws ExperimentParserError failed to parse the experiment
* @see JsonParser#parseAllowedKeys(List)
*/
public JSONMap parseAllowedKeys(List<String> allowedKeys, String source) throws ExperimentParserError, IOException {
try {
return new JSONMap(new JsonParser(source).parseAllowedKeys(allowedKeys));
} catch (JsonParserException parserException) {
throw new ExperimentParserError(experimentId, file.getSymbolicPath(), parserException.getMessage());View on GitHub (pinned to a66e9ccd1d)
Solutions
- Open the named file at the character position in the parser message and inspect the syntax error.
- Regenerate the log from a clean, completed run.
- If hand-assembling logs, keep exactly one JSON value per line for optimization logs and one document for proftool output.
- Check disk space / process exit status of the original run.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-validate JSON syntax with the same parser used internally
try {
new org.graalvm.profdiff.utils.JsonParser(source).parse();
} catch (JsonParserException e) {
throw new IllegalArgumentException("Invalid JSON in " + path + ": " + e.getMessage());
} Try / catch
try {
parser.parse();
} catch (ExperimentParserError e) {
// contains the JsonParserException message with line/column; fix or regenerate the file
} Prevention
- Ensure the measured JVM exits cleanly so logs are fully flushed.
- Keep one JSON document per line in optimization logs.
When it happens
Trigger: A truncated or concatenated-wrongly optimization-log file (units are newline-separated JSON), binary garbage, HTML error pages saved as logs, or a proftool output cut off mid-write.
Common situations: Logs truncated by a killed JVM or full disk; files transferred with encoding corruption; multiple JSON documents concatenated without the expected newline framing; appending to an existing log with a partial line.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Failed to parse experiment {experimentId} in compilation uni
- Failed to parse experiment {experimentId} in {resource}: exp
- Failed to parse experiment {experimentId} in {resource}: exp
- Could not read the files of the experiment {experimentId}: {
- Error loading phase plan from %s
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/9bbe07d1911fe176.
Report an issue: GitHub.