{"record":{"id":"0bf0219ea983992c","repo":"openjdk/jdk","slug":"error-can-t-open-replay-file-s","errorCode":null,"errorMessage":"ERROR: Can't open replay file %s\n","messagePattern":"ERROR: Can't open replay file (.+?)\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/hotspot/share/ci/ciReplay.cpp","lineNumber":151,"sourceCode":"  char* _bufptr;\n  char* _buffer;\n  int   _buffer_length;\n  ReallocMark _nesting; // Safety checks for arena reallocation\n\n  // \"compile\" data\n  ciKlass* _iklass;\n  Method*  _imethod;\n  int      _entry_bci;\n  int      _comp_level;\n\n public:\n  CompileReplay(const char* filename, TRAPS) {\n    _thread = THREAD;\n    _loader = Handle(_thread, SystemDictionary::java_system_loader());\n\n    _stream = os::fopen(filename, \"rt\");\n    if (_stream == nullptr) {\n      fprintf(stderr, \"ERROR: Can't open replay file %s\\n\", filename);\n    }\n\n    _ci_inline_records = nullptr;\n    _error_message = nullptr;\n\n    _buffer_length = 32;\n    _buffer = NEW_RESOURCE_ARRAY(char, _buffer_length);\n    _bufptr = _buffer;\n\n    _imethod = nullptr;\n    _iklass  = nullptr;\n    _entry_bci  = 0;\n    _comp_level = 0;\n    _version = 0;\n\n    test();\n  }\n","sourceCodeStart":133,"sourceCodeEnd":169,"githubUrl":"https://github.com/openjdk/jdk/blob/88dfb74bbeefcf2b0aa11835183bcd949998fc8f/src/hotspot/share/ci/ciReplay.cpp#L133-L169","documentation":"ciReplay (the -XX:+ReplayCompiles / -XX:ReplayDataFile=<file> machinery that replays a recorded compilation) failed to open the replay data file: CompileReplay's constructor does os::fopen(filename, \"rt\") and the result is null. It only prints the error — execution continues and parsing of the null stream fails immediately after, so replay silently does nothing.","triggerScenarios":"Running java with -XX:+ReplayCompiles (or ciReplay::replay_impl triggered via the replay task) where the replay data file (default replay_pid<pid>.log, or the file named by -XX:ReplayDataFile=) does not exist, is not readable, or the path is relative to a different working directory than expected.","commonSituations":"After a JVM crash the hs-err file asks to run 'java -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid123.log ...' but the user runs from a different cwd; the replay file was cleaned up; permissions issues in sandboxed CI; typo in the ReplayDataFile path.","solutions":["Check that the replay data file exists at the exact path passed to -XX:ReplayDataFile (or replay_pid<pid>.log in the cwd for the default)","Use an absolute path: -XX:ReplayDataFile=/abs/path/replay_pid123.log","Verify read permissions on the file for the user running the JVM","If the file was produced by a crashed process, re-run the original failing command from the directory where the crash happened so the relative default path resolves"],"exampleFix":"# before\njava -XX:+ReplayCompiles -XX:ReplayDataFile=replay_pid123.log Main\n# (run from wrong cwd -> file not found)\n\n# after\njava -XX:+ReplayCompiles -XX:ReplayDataFile=/home/user/crash/replay_pid123.log Main","handlingStrategy":"validation","validationCode":"# Before running replay, verify the data file:\nREPLAY=/abs/path/replay_pid$$.log\n[ -f \"$REPLAY\" ] && [ -r \"$REPLAY\" ] || { echo \"missing replay file $REPLAY\" >&2; exit 2; }\njava -XX:+ReplayCompiles -XX:ReplayDataFile=\"$REPLAY\" -Xbatch Main","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass an absolute -XX:ReplayDataFile path so cwd cannot matter","Copy replay files next to the bug report checklist (they are small) when capturing crash repro data"],"tags":["hotspot","cireplay","compiler","diagnostics","file-not-found"],"backgroundTag":null,"analyzedSha":"88dfb74bbeefcf2b0aa11835183bcd949998fc8f","analyzedAt":"2026-08-14T11:45:09.665Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}