{"record":{"id":"5e5db6bcfb780c49","repo":"apache/cassandra","slug":"invalid-throttle-for-snapshot-links-per-second-mu","errorCode":null,"errorMessage":"Invalid throttle for snapshot_links_per_second: must be positive","messagePattern":"Invalid throttle for snapshot_links_per_second: must be positive","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":4172,"sourceCode":"    {\n        conf.auto_snapshot = autoSnapshot;\n    }\n\n    @VisibleForTesting\n    public static boolean getAutoSnapshot()\n    {\n        return conf.auto_snapshot;\n    }\n\n    public static long getSnapshotLinksPerSecond()\n    {\n        return conf.snapshot_links_per_second == 0 ? Long.MAX_VALUE : conf.snapshot_links_per_second;\n    }\n\n    public static void setSnapshotLinksPerSecond(long throttle)\n    {\n        if (throttle < 0)\n            throw new IllegalArgumentException(\"Invalid throttle for snapshot_links_per_second: must be positive\");\n\n        conf.snapshot_links_per_second = throttle;\n    }\n\n    public static RateLimiter getSnapshotRateLimiter()\n    {\n        return RateLimiter.create(getSnapshotLinksPerSecond());\n    }\n\n    public static boolean isAutoBootstrap()\n    {\n        return AUTO_BOOTSTRAP.getBoolean(conf.auto_bootstrap);\n    }\n\n    public static void setHintedHandoffEnabled(boolean hintedHandoffEnabled)\n    {\n        conf.hinted_handoff_enabled = hintedHandoffEnabled;\n    }","sourceCodeStart":4154,"sourceCodeEnd":4190,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L4154-L4190","documentation":"Cassandra throws this IllegalArgumentException when setSnapshotLinksPerSecond is called with a negative throttle value. snapshot_links_per_second throttles the rate of hard-link creation during snapshots; negative values are meaningless and rejected.","triggerScenarios":"Calling DatabaseDescriptor.setSnapshotLinksPerSecond(-1) or any negative long, typically via JMX (StorageService/ColumnFamilyStore snapshot rate limiter settings) or programmatic config mutation.","commonSituations":"Automation scripts computing the throttle from a formula that can go negative, or operators intending 0 (= unlimited) but entering a negative number.","solutions":["Pass a non-negative value; use 0 to disable throttling (Long.MAX_VALUE effective rate)","Validate the computed value before calling setSnapshotLinksPerSecond","If unlimited snapshots are intended, simply omit the setting instead of a sentinel negative"],"exampleFix":"// before\nDatabaseDescriptor.setSnapshotLinksPerSecond(throttleFromConfig); // -5\n// after\nif (throttleFromConfig >= 0) DatabaseDescriptor.setSnapshotLinksPerSecond(throttleFromConfig);","handlingStrategy":"validation","validationCode":"if (throttle < 0) throw new IllegalArgumentException(\"snapshot_links_per_second must be >= 0 (0 = unlimited)\");","typeGuard":null,"tryCatchPattern":"try {\n    DatabaseDescriptor.setSnapshotLinksPerSecond(throttle);\n} catch (IllegalArgumentException e) {\n    logger.warn(\"Rejected snapshot throttle, keeping current value\", e);\n}","preventionTips":["Clamp computed throttles with Math.max(0, value)","Treat 0 as 'unlimited', never use negative sentinels","Validate user/JMX input before applying"],"tags":["configuration","snapshot","validation"],"backgroundTag":"invalid-argument-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}