{"record":{"id":"2aeb921005d41756","repo":"apache/cassandra","slug":"parameter-older-than-timestamp-has-to-be-a-valid","errorCode":null,"errorMessage":"Parameter --older-than-timestamp has to be a valid instant in ISO format.","messagePattern":"Parameter --older-than-timestamp has to be a valid instant in ISO format\\.","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/ClearSnapshot.java","lineNumber":85,"sourceCode":"            throw new IllegalArgumentException(\"Specify only one of snapshot name or --all\");\n\n        if (olderThan != null && olderThanTimestamp != null)\n            throw new IllegalArgumentException(\"Specify only one of --older-than or --older-than-timestamp\");\n\n        if (!snapshotName.isEmpty() && olderThan != null)\n            throw new IllegalArgumentException(\"Specifying snapshot name together with --older-than flag is not allowed\");\n\n        if (!snapshotName.isEmpty() && olderThanTimestamp != null)\n            throw new IllegalArgumentException(\"Specifying snapshot name together with --older-than-timestamp flag is not allowed\");\n\n        if (olderThanTimestamp != null)\n            try\n            {\n                Instant.parse(olderThanTimestamp);\n            }\n            catch (DateTimeParseException ex)\n            {\n                throw new IllegalArgumentException(\"Parameter --older-than-timestamp has to be a valid instant in ISO format.\");\n            }\n\n        Long olderThanInSeconds = null;\n        if (olderThan != null)\n            // fail fast when it is not valid\n            olderThanInSeconds = new DurationSpec.LongSecondsBound(olderThan).toSeconds();\n\n        StringBuilder sb = new StringBuilder();\n\n        sb.append(\"Requested clearing snapshot(s) for \");\n\n        if (keyspaces.isEmpty())\n            sb.append(\"[all keyspaces]\");\n        else\n            sb.append('[').append(join(keyspaces, \", \")).append(']');\n\n        if (snapshotName.isEmpty())\n            sb.append(\" with [all snapshots]\");","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/ClearSnapshot.java#L67-L103","documentation":"IllegalArgumentException from ClearSnapshot.execute: the --older-than-timestamp value failed to parse as a valid ISO-8601 instant. The flag requires an absolute timestamp (e.g. 2024-01-01T00:00:00Z); any other format is rejected before snapshots are cleared.","triggerScenarios":"Passing dates like `2026-01-01`, `01/01/2026`, epoch seconds `1767225600`, or timestamps missing the UTC 'Z' designator to --older-than-timestamp.","commonSituations":"Shell date output in non-ISO formats, users giving plain dates without time/timezone, epoch milliseconds pasted instead of ISO strings.","solutions":["Format the value as ISO-8601 instant, e.g. `--older-than-timestamp 2026-01-01T00:00:00Z`","Generate it in shell with `date -u +%Y-%m-%dT%H:%M:%SZ`","Use `--older-than <duration>` (e.g. 7d) instead if an absolute timestamp is awkward"],"exampleFix":"// before\nnodetool clearsnapshot --all --older-than-timestamp 2026-01-01\n// after\nnodetool clearsnapshot --all --older-than-timestamp 2026-01-01T00:00:00Z","handlingStrategy":"validation","validationCode":"from datetime import datetime, timezone\nts = datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')\n# pass e.g. 2026-01-01T00:00:00Z; validate:\ndatetime.strptime(ts, '%Y-%m-%dT%H:%M:%SZ')","typeGuard":null,"tryCatchPattern":"try { clearSnapshot(); }\ncatch (IllegalArgumentException e) { System.err.println(\"use ISO-8601 instant, e.g. 2026-01-01T00:00:00Z\"); }","preventionTips":["Always include time and Z timezone designator","Generate timestamps with date -u +%Y-%m-%dT%H:%M:%SZ","Prefer --older-than durations for relative cutoffs"],"tags":["nodetool","cli","validation","date-format"],"backgroundTag":"invalid-date-format","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"}