oracle/graal · error · IllegalArgumentException
Expected a map.
Error message
Expected a map.
What it means
The tagged overload deserialize(json, proxyFactory, tag) requires the node to be an EconomicMap — unlike the untagged overload, it cannot pass through scalars because it has no way to attach type information to them. IllegalArgumentException('Expected a map.') fires when the JSON node at that position is a scalar/array where an object map was required.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/JsonReplayCodec.java:1968
}
return deserializer.deserialize(map, this, proxyFactory);
} else {
return json;
}
}
@Override
@SuppressWarnings("unchecked")
public Object deserialize(Object json, CompilationProxies.ProxyFactory proxyFactory, String tag) throws DeserializationException {
if (json instanceof EconomicMap<?, ?>) {
EconomicMap<String, Object> map = (EconomicMap<String, Object>) json;
ObjectSerializer deserializer = tagSerializers.get(tag);
if (deserializer == null) {
throw new IllegalArgumentException("No deserializer registered for tag " + tag);
}
return deserializer.deserialize(map, this, proxyFactory);
} else {
throw new IllegalArgumentException("Expected a map.");
}
}
private Architecture architecture;
@Override
public void setArchitecture(Architecture arch) {
architecture = arch;
}
@Override
public Architecture getArchitecture() {
return architecture;
}
};
}
/**View on GitHub (pinned to a66e9ccd1d)
Solutions
- Inspect the replay file at the position indicated by the enclosing deserializer's context and restore the object node with its 'tag'
- Re-record the file with the same build
- If the value is legitimately a scalar, route it through the untagged deserialize overload instead
Defensive patterns
Strategy: type-guard
Type guard
// Guard the node kind before the tagged call
if (!(json instanceof EconomicMap<?,?>)) {
throw new IllegalArgumentException("Expected a tagged object node, got: " + json);
} Prevention
- Do not restructure replay JSON by hand (inlining objects as scalars breaks the tagged format)
- Validate tree shape (object nodes where tags are expected) before deserialization
When it happens
Trigger: A tagged deserialization lands on a non-map node: file structure drifted (a field that used to be an object became a plain value), hand-edited JSON inlining a scalar where an object belongs, or a codec version change moving a field's shape.
Common situations: Manual JSON restructuring; version skew changing whether a value is boxed in an object with a tag or written inline; parser differences producing lists where maps are expected.
Related errors
- Unknown class ${className} for constant${value}
- The replay map does not contain a tag: ${map}
- Failed to serialize ${op} due to: ${cause}
- No singleton found for ${registration}
- Invalid marker type.
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/5448b00f946abb28.
Report an issue: GitHub.