oracle/graal · error · IOException
Invalid replay string definition index
Error message
Invalid replay string definition index
What it means
IOException thrown by BinaryReplayCodec.ReadState.defineString when a string-definition record's index does not equal the string table's current size. Definitions must append strictly sequentially (index == size) so lookups stay dense; a gap or repeat means the stream is malformed or out of sync with the codec that wrote it.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/BinaryReplayCodec.java:259
@SuppressWarnings("unchecked") private final EconomicMap<Integer, Object>[] instanceProxies = (EconomicMap<Integer, Object>[]) new EconomicMap<?, ?>[registrations.length];
private Architecture architecture = hostTarget.arch;
private ReadState(CompilationProxies.ProxyFactory proxyFactory) {
this.proxyFactory = proxyFactory;
stringTable.add(null);
}
private String stringAt(int index) throws IOException {
if (index < 0 || index >= stringTable.size()) {
throw new IOException("Invalid replay string table index " + index);
}
return stringTable.get(index);
}
private void defineString(int index, String value) throws IOException {
if (index != stringTable.size()) {
throw new IOException("Invalid replay string definition index " + index);
}
stringTable.add(value);
}
private CompilationProxy.SymbolicMethod methodAt(int index) throws IOException {
if (index < 0 || index >= methodTable.size()) {
throw new IOException("Invalid replay symbolic method index " + index);
}
return methodTable.get(index);
}
private void defineMethod(int index, CompilationProxy.SymbolicMethod method) throws IOException {
if (index != methodTable.size()) {
throw new IOException("Invalid replay symbolic method definition index " + index);
}
methodTable.add(method);
}
View on GitHub (pinned to a66e9ccd1d)
Solutions
- Re-record the replay data on the same build you replay with.
- Discard and re-transfer the file to rule out truncation/corruption.
- Keep replay artifacts pinned to the compiler version that produced them.
Defensive patterns
Strategy: validation
Try / catch
try {
replayCodec.decode(input);
} catch (IOException e) {
if (e.getMessage().startsWith("Invalid replay string definition index")) {
// stream out of sync: regenerate with matching build
}
throw e;
} Prevention
- Never hand-edit or append to binary replay files.
- Freeze the compiler build between record and replay steps.
When it happens
Trigger: Decoding a replay stream whose next DEFINE_STRING record carries an index other than table.size() — e.g. after a truncated prefix (missing earlier definitions) or a codec-version mismatch that changed record ordering.
Common situations: Replay files recorded and replayed with different compiler builds; partially downloaded or appended-to files; concurrent/corrupted writes during profile capture.
Related errors
- Invalid replay string table index
- Invalid replay symbolic method index
- Invalid replay symbolic method definition index
- Invalid replay registration index
- Registration is not a singleton
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/e0aa814c2f77e913.
Report an issue: GitHub.