{"record":{"id":"4aed6fd3b7ba5c00","repo":"aeron-io/aeron","slug":"no-recording-found-with-recordingid-targetrecordingid","errorCode":null,"errorMessage":"no recording found with recordingId: \" + targetRecordingId","messagePattern":"no recording found with recordingId: \" \\+ targetRecordingId","errorType":"exception","errorClass":"AeronException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/ArchiveTool.java","lineNumber":861,"sourceCode":"            final MutableBoolean found = new MutableBoolean(false);\n            catalog.forEach((recordingDescriptorOffset,\n                headerEncoder,\n                headerDecoder,\n                descriptorEncoder,\n                descriptorDecoder) ->\n            {\n                final long recordingId = descriptorDecoder.recordingId();\n                if (NULL_RECORD_ID == targetRecordingId || targetRecordingId == recordingId)\n                {\n                    found.set(true);\n                    final List<String> files = segmentFilesByRecordingId.getOrDefault(recordingId, emptyList());\n                    deleteOrphanedSegmentFiles(out, archiveDir, descriptorDecoder, files);\n                }\n            });\n\n            if (NULL_RECORD_ID != targetRecordingId && !found.get())\n            {\n                throw new AeronException(\"no recording found with recordingId: \" + targetRecordingId);\n            }\n        }\n    }\n\n    static void compact(final PrintStream out, final File archiveDir, final EpochClock epochClock)\n    {\n        final File compactFile = new File(archiveDir, CATALOG_FILE_NAME + \".compact\");\n        try\n        {\n            final MutableInteger offset = new MutableInteger(CatalogHeaderEncoder.BLOCK_LENGTH);\n            final MutableInteger deletedRecords = new MutableInteger();\n            final MutableInteger reclaimedBytes = new MutableInteger();\n\n            final Path compactFilePath = compactFile.toPath();\n            try (FileChannel channel = FileChannel.open(compactFilePath, READ, WRITE, CREATE_NEW);\n                Catalog catalog = openCatalogReadOnly(archiveDir, epochClock))\n            {\n                final MappedByteBuffer mappedByteBuffer = channel.map(READ_WRITE, 0, catalog.capacity());","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/ArchiveTool.java#L843-L879","documentation":"ArchiveTool.deleteOrphanedSegments looks up targetRecordingId in the Catalog and throws AeronException when a specific (non-NULL_RECORD_ID) recordingId was requested but no matching catalog entry was found. When targetRecordingId is NULL_RECORD_ID the tool processes all recordings and does not throw. It means the requested recording does not exist in this archive's Catalog.","triggerScenarios":"Running ArchiveTool deleteOrphanedSegments <archiveDir> <recordingId> with a recordingId absent from the Catalog; programmatic call to deleteOrphanedSegments with a stale or wrong id.","commonSituations":"Recording already deleted/compacted; wrong archive directory passed; typo in the id; id from a different archive instance.","solutions":["Verify the recordingId exists in the Catalog (describeRecording or catalog listing) before invoking deleteOrphanedSegments.","Point the tool at the correct archive directory.","Call with NULL_RECORD_ID to process all recordings instead of a specific one."],"exampleFix":"// before\nArchiveTool.deleteOrphanedSegments(out, archiveDir, clock, 12345L); // id gone -> throws\n// after\nif (catalogHasRecording(archiveDir, 12345L)) {\n    ArchiveTool.deleteOrphanedSegments(out, archiveDir, clock, 12345L);\n}","handlingStrategy":"validation","validationCode":"if (targetRecordingId != Aeron.NULL_VALUE && !catalogContainsRecording(archiveDir, targetRecordingId)) {\n    throw new IllegalArgumentException(\"recordingId \" + targetRecordingId + \" not found in \" + archiveDir);\n}","typeGuard":null,"tryCatchPattern":"try {\n    ArchiveTool.deleteOrphanedSegments(out, archiveDir, clock, targetRecordingId);\n} catch (AeronException e) {\n    if (e.getMessage().contains(\"no recording found\")) { /* skip or alert */ } else throw e;\n}","preventionTips":["Re-resolve recordingIds from the catalog immediately before segment maintenance.","Avoid hardcoding recordingIds in scripts; read them from the catalog at runtime.","Run orphan cleanup without a specific id (NULL_RECORD_ID) to process all existing recordings."],"tags":["aeron","archive","not-found"],"backgroundTag":"record-not-found","analyzedSha":"6d60124e15e35c11b49ba2e3c2c2858a09a18803","analyzedAt":"2026-09-12T11:17:07.683Z","contentChangedAt":"2026-09-12T11:17:07.683Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}