{"record":{"id":"727d073970c2e3ad","repo":"apache/cassandra","slug":"exception-occured-while-executing-s","errorCode":null,"errorMessage":"Exception occured while executing %s","messagePattern":"Exception occured while executing (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/snapshot/SnapshotManager.java","lineNumber":556,"sourceCode":"            prePopulateSnapshots(task);\n            return task.call();\n        }\n        catch (Throwable t)\n        {\n            throw new RuntimeException(String.format(\"Exception occured while executing %s: %s\", task.toString(), t.getMessage()), t);\n        }\n    }\n\n    @VisibleForTesting\n    <T> T executeTask(AbstractSnapshotTask<T> task)\n    {\n        try\n        {\n            return task.call();\n        }\n        catch (Throwable t)\n        {\n            throw new RuntimeException(String.format(\"Exception occured while executing %s\", task.toString()), t);\n        }\n    }\n\n    /**\n     * Add table snapshots to snaphots cow list in advance in order to be sure that the snapshots to be created\n     * are not existing already. \"executeTask\" method can be invoked by multiple threads, and they hit\n     * this synchronized method which populates snapshots so next thread will fail to advance (exception is thrown)\n     * if table snapshots of some other tasks are already present in snapshots cow list.\n     *\n     * Added snapshots to snapshot list are at this point \"incomplete\", they will not appear in listing output\n     * until they are indeed taken and exist on disk, otherwise we would see \"phantom\" snapshots in listings,\n     * they would be present but in fact they are just going through the process of being taken.\n     *\n     * @param task task to process\n     */\n    private synchronized void prePopulateSnapshots(TakeSnapshotTask task)\n    {\n        Map<ColumnFamilyStore, TableSnapshot> snapshotsToCreate = task.getSnapshotsToCreate();","sourceCodeStart":538,"sourceCodeEnd":574,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/snapshot/SnapshotManager.java#L538-L574","documentation":"Variant of executeTask (without prePopulateSnapshots) that wraps any Throwable from task.call() into a RuntimeException 'Exception occured while executing <task>'. The real failure is always in the cause chain.","triggerScenarios":"Any AbstractSnapshotTask executed via this overload that throws — e.g. disk I/O failure while creating or clearing snapshots — is rethrown with this message.","commonSituations":"Snapshot creation/clearing invoked over JMX or scheduled (start, clearExpiredSnapshots) fails; the log shows this generic message instead of the root cause at top level.","solutions":["Read the 'Caused by' exception; fix the underlying issue it reports.","Check disk space and permissions on data/snapshot directories for create failures.","Re-run the specific snapshot command after remediation.","For recurring scheduled failures, add cause-aware logging around executeTask callers."],"exampleFix":"// before\nString msg = ex.getMessage(); // \"Exception occured while executing ...\"\n// after\nThrowable root = ex; while (root.getCause() != null) root = root.getCause(); log.error(root.getMessage());","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { result = executeTask(task); } catch (RuntimeException e) { Throwable root = e; while (root.getCause() != null) root = root.getCause(); log.error(\"Root cause: {}\", root.getMessage()); }","preventionTips":["Unwrap cause chains when triaging snapshot failures","Pre-check disk space and permissions before scheduled snapshot runs","Add alerts on repeated snapshot task failures"],"tags":["snapshot","wrapper-exception","runtimeexception"],"backgroundTag":"internal-invariant-violation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}