{"record":{"id":"39723fe2edbc195d","repo":"apache/cassandra","slug":"unable-to-parse-precision-of-value","errorCode":null,"errorMessage":"Unable to parse precision of value ","messagePattern":"Unable to parse precision of value ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java","lineNumber":154,"sourceCode":"                if (!directory.exists())\n                {\n                    if (!directory.tryCreateDirectory())\n                    {\n                        throw new RuntimeException(\"Unable to create directory: \" + dir);\n                    }\n                }\n            }\n        }\n\n        String precisionPropertyValue = commitlogCommands.getProperty(\"precision\", TimeUnit.MICROSECONDS.name());\n        TimeUnit precision;\n        try\n        {\n            precision = TimeUnit.valueOf(precisionPropertyValue);\n        }\n        catch (IllegalArgumentException ex)\n        {\n            throw new RuntimeException(\"Unable to parse precision of value \" + precisionPropertyValue, ex);\n        }\n        if (precision == TimeUnit.NANOSECONDS)\n            throw new RuntimeException(\"NANOSECONDS level precision is not supported.\");\n\n        String targetTime = commitlogCommands.getProperty(\"restore_point_in_time\");\n        long restorePointInTime = Long.MAX_VALUE;\n        try\n        {\n            if (!Strings.isNullOrEmpty(targetTime))\n            {\n                // get restorePointInTime in microseconds level by default as cassandra use this level's timestamp\n                restorePointInTime = getRestorationPointInTimeInMicroseconds(targetTime);\n            }\n        }\n        catch (DateTimeParseException e)\n        {\n            throw new RuntimeException(\"Unable to parse restore target time\", e);\n        }","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/CommitLogArchiver.java#L136-L172","documentation":"Thrown when the 'precision' property in commitlog_archiving.properties is not a valid java.util.concurrent.TimeUnit name. Cassandra parses it with TimeUnit.valueOf(), which only accepts HOURS, MINUTES, SECONDS, MILLISECONDS, MICROSECONDS (NANOSECONDS rejected separately). The IllegalArgumentException is chained.","triggerScenarios":"getArchiverFromProperties() reads property 'precision' with a value like 'microseconds', 'us', or 'Microseconds' and TimeUnit.valueOf() throws IllegalArgumentException.","commonSituations":"Lowercase or abbreviated time units in the properties file; copy-pasted values like 'micro' or 'µs'; confusion between the property name and accepted enum constants.","solutions":["Set precision to an exact uppercase TimeUnit constant, e.g. MICROSECONDS (the default).","Remove the precision line entirely to accept the default (MICROSECONDS).","Use HOURS, MINUTES, SECONDS, MILLISECONDS, or MICROSECONDS only — NANOSECONDS is explicitly unsupported."],"exampleFix":"# before\nprecision: microseconds\n# after\nprecision: MICROSECONDS","handlingStrategy":"validation","validationCode":"String p = props.getProperty(\"precision\");\nSet<String> allowed = Set.of(\"HOURS\",\"MINUTES\",\"SECONDS\",\"MILLISECONDS\",\"MICROSECONDS\");\nif (p != null && !allowed.contains(p.trim().toUpperCase()))\n    throw new IllegalArgumentException(\"precision must be one of \" + allowed);","typeGuard":null,"tryCatchPattern":"try { archiver = CommitLogArchiver.construct(); }\ncatch (RuntimeException e) {\n    if (e.getMessage().startsWith(\"Unable to parse precision\"))\n        log.error(\"precision must be an uppercase TimeUnit constant\", e);\n    throw e;\n}","preventionTips":["Use only uppercase TimeUnit constant names in commitlog_archiving.properties","Add config linting to CI that validates precision values","Omit precision to accept the MICROSECONDS default"],"tags":["cassandra","commitlog","configuration","enum"],"backgroundTag":"invalid-enum-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"}