oracle/graal · error · UnsupportedOperationException
injectProfiles during replay
Error message
injectProfiles during replay
What it means
Thrown by ReplayCompilationSupport.injectProfiles when the method is called while the support object is in replay mode rather than recording mode. Profile injection only makes sense while recording (there is a live RecordingCompilationProxies to store the profiles); during replay, profiles come from the replay file, so the call is rejected with UnsupportedOperationException.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/replaycomp/ReplayCompilationSupport.java:514
CompilationTaskProduct product = compilationProduct.get();
compilationProduct.remove();
return product;
}
/**
* Injects profiles for the given method during recording.
*
* @param method the method to inject profiles into
* @param includeNormal whether to include normal profiles
* @param includeOSR whether to include OSR profiles
* @param profilingInfo the profiling information to inject
* @throws UnsupportedOperationException if called during replay
*/
public void injectProfiles(ResolvedJavaMethod method, boolean includeNormal, boolean includeOSR, ProfilingInfo profilingInfo) {
if (proxies instanceof RecordingCompilationProxies recordingProxies) {
recordingProxies.injectProfiles(method, includeNormal, includeOSR, profilingInfo);
} else {
throw new UnsupportedOperationException("injectProfiles during replay");
}
}
}
View on GitHub (pinned to a66e9ccd1d)
Solutions
- Only call injectProfiles during the recording phase (proxies instanceof RecordingCompilationProxies); during replay rely on the recorded data.
- Gate the caller on the current mode (recording vs replay) before invoking injectProfiles.
- Update both sides (recorder and replayer) to the same GraalVM build so the mode detection is consistent.
Example fix
// before
support.injectProfiles(method, true, true, profilingInfo);
// after
if (support.isRecording()) {
support.injectProfiles(method, true, true, profilingInfo);
} Defensive patterns
Strategy: type-guard
Type guard
// only inject when recording
if (support.getProxies() instanceof RecordingCompilationProxies) {
support.injectProfiles(method, true, true, profilingInfo);
} Prevention
- Gate all profile-injection call sites on recording mode, not replay mode.
- During replay, rely exclusively on the data in the replay file.
When it happens
Trigger: Calling ReplayCompilationSupport.injectProfiles(method, includeNormal, includeOSR, profilingInfo) when the internal proxies field is a replay (non-recording) proxies instance — i.e. running with -Dgraal.ReplayCompilation in replay mode and something in the pipeline still tries to inject fresh profiles.
Common situations: Code written for the recording flow being reused during replay; a GraalVM version change where profile injection moved behind this guard; replaying a file while host VM flags enable profile injection paths.
Related errors
- Unexpected marker
- No serializer for :
- Unknown enum constant for
- Unknown replay marker kind
- Unknown field
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/72f26f3bd380285c.
Report an issue: GitHub.