{"record":{"id":"7c7f2ae347cf082b","repo":"aeron-io/aeron","slug":"replicationparams-livedestination-and-replicationparams","errorCode":null,"errorMessage":"ReplicationParams.liveDestination and ReplicationParams.sessionId can not be specified together","messagePattern":"ReplicationParams\\.liveDestination and ReplicationParams\\.sessionId can not be specified together","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/ArchiveProxy.java","lineNumber":1252,"sourceCode":"     * @param srcControlChannel  remote control channel for the source archive to instruct the replay on.\n     * @param srcControlStreamId remote control stream id for the source archive to instruct the replay on.\n     * @param replicationParams  optional parameters to control the behaviour of the replication.\n     * @param correlationId      for this request.\n     * @param controlSessionId   for this request.\n     * @return {@code true} if successfully offered otherwise {@code false}.\n     * @see ReplicationParams\n     */\n    public boolean replicate(\n        final long srcRecordingId,\n        final int srcControlStreamId,\n        final String srcControlChannel,\n        final ReplicationParams replicationParams,\n        final long correlationId,\n        final long controlSessionId)\n    {\n        if (null != replicationParams.liveDestination() && Aeron.NULL_VALUE != replicationParams.replicationSessionId())\n        {\n            throw new IllegalArgumentException(\n                \"ReplicationParams.liveDestination and ReplicationParams.sessionId can not be specified together\");\n        }\n\n        return replicate(\n            srcRecordingId,\n            replicationParams.dstRecordingId(),\n            replicationParams.stopPosition(),\n            replicationParams.channelTagId(),\n            replicationParams.subscriptionTagId(),\n            srcControlStreamId,\n            srcControlChannel,\n            replicationParams.liveDestination(),\n            replicationParams.replicationChannel(),\n            correlationId,\n            controlSessionId,\n            replicationParams.fileIoMaxLength(),\n            replicationParams.replicationSessionId(),\n            replicationParams.encodedCredentials(),","sourceCodeStart":1234,"sourceCodeEnd":1270,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/ArchiveProxy.java#L1234-L1270","documentation":"An IllegalArgumentException thrown by ArchiveProxy.replicate when ReplicationParams specifies both a liveDestination (following a live stream) and a replicationSessionId (attaching to an existing replication session). These two options are mutually exclusive: one starts new live replication, the other joins an existing session.","triggerScenarios":"Calling archiveProxy.replicate (directly or via AeronArchive.replicate) with ReplicationParams where liveDestination() != null AND replicationSessionId() != Aeron.NULL_VALUE.","commonSituations":"Developer configures ReplicationParams for live-follow replication and also sets a session id copied from another replication; builder reuse across calls leaving stale fields set.","solutions":["Remove ReplicationParams.replicationSessionId if you want a new live replication with a liveDestination","Remove ReplicationParams.liveDestination if you intend to join an existing replication session by id","Build a fresh ReplicationParams per replicate() call instead of reusing a mutated one"],"exampleFix":"// before\nReplicationParams params = new ReplicationParams()\n    .liveDestination(\"aeron:udp?endpoint=src:40456\")\n    .replicationSessionId(sessionId); // conflict\n// after\nReplicationParams params = new ReplicationParams()\n    .liveDestination(\"aeron:udp?endpoint=src:40456\"); // pick one option","handlingStrategy":"validation","validationCode":"if (params.liveDestination() != null && params.replicationSessionId() != Aeron.NULL_VALUE) {\n    throw new IllegalStateException(\"liveDestination and replicationSessionId are mutually exclusive\");\n}","typeGuard":"boolean replicationParamsConsistent(ReplicationParams p) {\n    return !(p.liveDestination() != null && p.replicationSessionId() != Aeron.NULL_VALUE);\n}","tryCatchPattern":"try { archive.replicate(srcRecordingId, params); } catch (IllegalArgumentException e) { sanitizeParamsAndRetry(); }","preventionTips":["Build a fresh ReplicationParams per call to avoid stale fields","Decide between live-follow and session-attach modes up front","Unit-test ReplicationParams construction helpers"],"tags":["aeron-archive","replication","mutually-exclusive","illegal-argument"],"backgroundTag":"mutually-exclusive-options","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"}