{"record":{"id":"04b03f108f6f4be7","repo":"aeron-io/aeron","slug":"no-position-encoded-in-the-segment-file-filename","errorCode":null,"errorMessage":"no position encoded in the segment file: \" + filename","messagePattern":"no position encoded in the segment file: \" \\+ filename","errorType":"exception","errorClass":"ArchiveException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/Catalog.java","lineNumber":1203,"sourceCode":"            }\n        }\n\n        return maxFileName;\n    }\n\n    static long parseSegmentFilePosition(final String filename)\n    {\n        final int dashOffset = filename.indexOf('-');\n        if (-1 == dashOffset)\n        {\n            throw new ArchiveException(\"invalid filename format: \" + filename);\n        }\n\n        final int positionOffset = dashOffset + 1;\n        final int positionLength = filename.length() - positionOffset - RECORDING_SEGMENT_SUFFIX.length();\n        if (0 >= positionLength)\n        {\n            throw new ArchiveException(\"no position encoded in the segment file: \" + filename);\n        }\n\n        return parseLongAscii(filename, positionOffset, positionLength);\n    }\n\n    static long parseSegmentFileRecordingId(final String filename)\n    {\n        final int dashOffset = filename.indexOf('-');\n        if (-1 == dashOffset || 0 == dashOffset)\n        {\n            throw new InvalidRecordingNameException(\"invalid filename format: \" + filename);\n        }\n\n        return parseLongAscii(filename, 0, dashOffset);\n    }\n\n    static long computeStopPosition(\n        final File archiveDir,","sourceCodeStart":1185,"sourceCodeEnd":1221,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/Catalog.java#L1185-L1221","documentation":"Thrown by Catalog.parseSegmentFilePosition when the filename has a '-' separator but the characters after it (minus the '.rec' suffix) form an empty string, i.e. no replay position is encoded. The archive needs that encoded position to recover the recording's last segment offset.","triggerScenarios":"Parsing a segment filename like '<recordingId>-.rec' or '<recordingId>-rec' where the position portion between the dash and the suffix is missing or zero-length.","commonSituations":"Truncated filenames after disk-full crashes, manual renaming that dropped the position, or custom tooling that wrote segment files with an incorrect naming pattern.","solutions":["Fix or restore the segment filename so it encodes a numeric position after the recordingId, e.g. '12-0.rec'","Delete or quarantine the malformed segment file if it holds no useful data so catalog recovery can proceed","Restore the archive directory from backup instead of hand-repairing names","Check that writing tooling uses Aeron's own segment naming (recordingId + '-' + position + RECORDING_SEGMENT_SUFFIX)"],"exampleFix":"// before: malformed name\nFiles.move(dir.resolve(\"12-.rec\"), dir.resolve(\"12.rec\"));\n// after: re-encode position 0\nFiles.move(dir.resolve(\"12-.rec\"), dir.resolve(\"12-0.rec\"));","handlingStrategy":"validation","validationCode":"static boolean hasEncodedPosition(String f) {\n    if (f == null || !f.endsWith(\".rec\")) return false;\n    int dash = f.indexOf('-');\n    return dash >= 0 && f.length() - dash - 1 - 4 > 0;\n}","typeGuard":"boolean isCompleteSegmentName(String name) { return name != null && name.matches(\"\\\\d+-\\\\d+\\\\.rec\"); }","tryCatchPattern":"try {\n    pos = Catalog.parseSegmentFilePosition(filename);\n} catch (ArchiveException e) {\n    quarantineOrRepair(filename);\n}","preventionTips":["Confirm filenames end with a numeric position before the '.rec' suffix","Use Aeron's own tooling (ArchiveTool) for catalog maintenance instead of manual edits","Monitor for truncated filenames after disk-full events","Keep backups of the archive directory before recovery operations"],"tags":["aeron-archive","filename-parsing","catalog","corruption"],"backgroundTag":"invalid-argument-format","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}