{"record":{"id":"58c0b5ba31417fa2","repo":"aeron-io/aeron","slug":"aeronarchivecontext-must-be-set","errorCode":null,"errorMessage":"aeronArchiveContext must be set","messagePattern":"aeronArchiveContext must be set","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"aeron-archive/src/main/java/io/aeron/archive/client/PersistentSubscription.java","lineNumber":1707,"sourceCode":"\n            if (Strings.isEmpty(liveChannel))\n            {\n                throw new ConfigurationException(\"liveChannel must be set\");\n            }\n\n            if (Strings.isEmpty(replayChannel))\n            {\n                throw new ConfigurationException(\"replayChannel must be set\");\n            }\n\n            if (Aeron.NULL_VALUE == replayStreamId)\n            {\n                throw new ConfigurationException(\"replayStreamId must be set\");\n            }\n\n            if (null == aeronArchiveContext)\n            {\n                throw new ConfigurationException(\"aeronArchiveContext must be set\");\n            }\n\n            if (null == listener)\n            {\n                listener = new NoOpPersistentSubscriptionListener();\n            }\n\n            if (0 > recordingId)\n            {\n                throw new ConfigurationException(\"invalid recordingId \" + recordingId);\n            }\n\n            if (FROM_LIVE > startPosition)\n            {\n                throw new ConfigurationException(\"invalid startPosition \" + startPosition);\n            }\n\n            final ChannelUri replayChannelUri = ChannelUri.parse(replayChannel);","sourceCodeStart":1689,"sourceCodeEnd":1725,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-archive/src/main/java/io/aeron/archive/client/PersistentSubscription.java#L1689-L1725","documentation":"A persistent subscription needs an AeronArchive.Context to create its archive client connection for replay requests. conclude() throws ConfigurationException when the aeronArchiveContext field is null, since without it the subscription cannot issue replay/position queries to the archive.","triggerScenarios":"conclude() invoked without calling context.aeronArchiveContext(AeronArchive.Context) (or a context-supplying constructor).","commonSituations":"Building the subscription standalone in tests without the archive context; refactoring code that used to inherit an AeronArchive context; DI/config frameworks failing to inject the archive context object.","solutions":["Create and attach an AeronArchive.Context: ctx.aeronArchiveContext(new AeronArchive.Context()) before conclude().","Reuse the AeronArchive.Context of an existing AeronArchive client so both share configuration.","Ensure the archive control request/response channels are configured in that context."],"exampleFix":"// before\nfinal PersistentSubscription.Context ctx = new PersistentSubscription.Context()\n    .recordingId(1)\n    .liveChannel(\"aeron:udp?endpoint=localhost:10000\")\n    .liveStreamId(5)\n    .replayChannel(\"aeron:udp?endpoint=localhost:10001\")\n    .replayStreamId(7);\nctx.conclude(); // throws: aeronArchiveContext must be set\n\n// after\nctx.aeronArchiveContext(new AeronArchive.Context()\n    .controlRequestChannel(\"aeron:udp?endpoint=localhost:8010\"));\nctx.conclude();","handlingStrategy":"validation","validationCode":"if (null == ctx.aeronArchiveContext()) {\n    throw new IllegalArgumentException(\"aeronArchiveContext must be set before conclude()\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    ctx.conclude();\n} catch (ConfigurationException e) {\n    // attach a default AeronArchive.Context and retry once\n}","preventionTips":["Reuse the AeronArchive.Context from your existing AeronArchive client instance.","Wrap persistent-subscription creation in a factory that always injects the archive context."],"tags":["aeron-archive","configuration","null-argument"],"backgroundTag":"missing-required-config-field","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"}