{"record":{"id":"763b8bf6d464af4e","repo":"apache/cassandra","slug":"commit-log-position-must-be-given-as-segment-po","errorCode":null,"errorMessage":"Commit log position must be given as <segment>,<position>","messagePattern":"Commit log position must be given as <segment>,<position>","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/commitlog/CommitLogPosition.java","lineNumber":131,"sourceCode":"        }\n\n        public CommitLogPosition deserialize(DataInputPlus in) throws IOException\n        {\n            return new CommitLogPosition(in.readLong(), in.readInt());\n        }\n\n        public long serializedSize(CommitLogPosition clsp)\n        {\n            return TypeSizes.sizeof(clsp.segmentId) + TypeSizes.sizeof(clsp.position);\n        }\n\n        public CommitLogPosition fromString(String position) throws ParseException\n        {\n            if (Strings.isNullOrEmpty(position))\n                return NONE;\n            String[] parts = position.split(\",\");\n            if (parts.length != 2)\n                throw new ParseException(\"Commit log position must be given as <segment>,<position>\", 0);\n            return new CommitLogPosition(Long.parseLong(parts[0].trim()), Integer.parseInt(parts[1].trim()));\n        }\n\n        public String toString(CommitLogPosition position)\n        {\n            return position == NONE ? \"\" : String.format(\"%d, %d\", position.segmentId, position.position);\n        }\n    }\n}\n","sourceCodeStart":113,"sourceCodeEnd":141,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/commitlog/CommitLogPosition.java#L113-L141","documentation":"CommitLogPosition's Format.fromString parses a human-readable commit log position string. An empty/null string maps to NONE, but any non-empty string that does not split into exactly two comma-separated parts (segment id, position) raises a java.text.ParseParseException 'Commit log position must be given as <segment>,<position>'.","triggerScenarios":"Calling CommitLogPosition.fromString with a value missing the comma or containing extra segments, e.g. configuration values for restore positions or tool arguments like '12345' or '1,2,3' instead of '12345,678'.","commonSituations":"Typo when setting a commit log restore position in configuration files, scripting that forgets the comma, or pasting a position that includes whitespace-separated instead of comma-separated values.","solutions":["Supply the value as '<segmentId>,<position>' with exactly one comma, e.g. '1690000000000,12345'.","Trim surrounding whitespace — parsing already trims inner parts, but the split still requires the comma delimiter.","Pass an empty string intentionally (maps to NONE) if no position bound is desired.","Validate input with a regex like '^\\d+,\\d+$' before handing it to fromString."],"exampleFix":"// before\nCommitLogPosition.fromString(\"1690000000000 12345\"); // ParseException\n// after\nCommitLogPosition.fromString(\"1690000000000,12345\");","handlingStrategy":"validation","validationCode":"if (position != null && !position.isBlank() && !position.matches(\"^\\\\s*\\\\d+\\\\s*,\\\\s*\\\\d+\\\\s*$\"))\n    throw new IllegalArgumentException(\"Position must be '<segment>,<position>'\");","typeGuard":null,"tryCatchPattern":"try { pos = CommitLogPosition.fromString(raw); } catch (ParseException e) { logger.error(\"Bad position '{}': use <segment>,<position>\", raw); }","preventionTips":["Always use the exact '<segment>,<position>' comma format","Copy positions from tooling output, not by retyping","Leave the value empty when no bound is intended"],"tags":["commitlog","parsing","configuration","format"],"backgroundTag":"invalid-argument-format","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"}