{"record":{"id":"779e1fff0bcbf897","repo":"prestodb/presto","slug":"cannot-write-recording-in-replay-mode","errorCode":null,"errorMessage":"Cannot write recording in replay mode","messagePattern":"Cannot write recording in replay mode","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/RecordingHiveMetastore.java","lineNumber":153,"sourceCode":"\n    private static <K, V> Cache<K, V> createCache(MetastoreClientConfig metastoreClientConfig)\n    {\n        if (metastoreClientConfig.isReplay()) {\n            return CacheBuilder.<K, V>newBuilder()\n                    .build();\n        }\n\n        return CacheBuilder.<K, V>newBuilder()\n                .expireAfterWrite(metastoreClientConfig.getRecordingDuration().toMillis(), MILLISECONDS)\n                .build();\n    }\n\n    @Managed\n    public void writeRecording()\n            throws IOException\n    {\n        if (replay) {\n            throw new IllegalStateException(\"Cannot write recording in replay mode\");\n        }\n\n        Recording recording = new Recording(\n                allDatabases,\n                allRoles,\n                toPairs(databaseCache),\n                toPairs(tableCache),\n                toPairs(tableConstraintsCache),\n                toPairs(supportedColumnStatisticsCache),\n                toPairs(tableStatisticsCache),\n                toPairs(partitionStatisticsCache),\n                toPairs(allTablesCache),\n                toPairs(allViewsCache),\n                toPairs(partitionCache),\n                toPairs(partitionNamesCache),\n                toPairs(partitionNamesByFilterCache),\n                toPairs(partitionsByNamesCache),\n                toPairs(tablePrivilegesCache),","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/RecordingHiveMetastore.java#L135-L171","documentation":"RecordingHiveMetastore.writeRecording is a JMX managed operation that flushes recorded metastore calls to disk. In replay mode no recording is being captured, so calling writeRecording is a usage error and an IllegalStateException is raised; only a recording-mode metastore can write a recording.","triggerScenarios":"Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/RecordingHiveMetastore.java:153 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the metastore in recording mode (replay disabled) before invoking writeRecording via JMX","If the goal is to consume a recording, use replay mode and read the previously captured file instead of writing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}