{"record":{"id":"ad9cd4b145735e17","repo":"aeron-io/aeron","slug":"params-must-be-used-as-a-complete-set-initialtermid-termid","errorCode":null,"errorMessage":"params must be used as a complete set: initialTermId termId termOffset channel=<channelUri>","messagePattern":"params must be used as a complete set: initialTermId termId termOffset channel=<channelUri>","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/SubscriptionParams.java","lineNumber":79,"sourceCode":"            params.isResponse = true;\n        }\n\n        int count = 0;\n\n        final String initialTermIdStr = channelUri.get(INITIAL_TERM_ID_PARAM_NAME);\n        count = initialTermIdStr != null ? count + 1 : count;\n\n        final String termIdStr = channelUri.get(TERM_ID_PARAM_NAME);\n        count = termIdStr != null ? count + 1 : count;\n\n        final String termOffsetStr = channelUri.get(TERM_OFFSET_PARAM_NAME);\n        count = termOffsetStr != null ? count + 1 : count;\n\n        if (count > 0)\n        {\n            if (count < 3)\n            {\n                throw new IllegalArgumentException(\"params must be used as a complete set: \" +\n                    INITIAL_TERM_ID_PARAM_NAME + \" \" +\n                    TERM_ID_PARAM_NAME + \" \" +\n                    TERM_OFFSET_PARAM_NAME + \" channel=\" + channelUri);\n            }\n\n            params.initialTermId = Integer.parseInt(initialTermIdStr);\n            params.termId = Integer.parseInt(termIdStr);\n            params.termOffset = Integer.parseInt(termOffsetStr);\n\n            if (params.termOffset < 0 || params.termOffset > LogBufferDescriptor.TERM_MAX_LENGTH)\n            {\n                throw new IllegalArgumentException(\n                    TERM_OFFSET_PARAM_NAME + \"=\" + params.termOffset + \" out of range: channel=\" + channelUri);\n            }\n\n            if (!FrameDescriptor.isFrameAligned(params.termOffset))\n            {\n                throw new IllegalArgumentException(","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/SubscriptionParams.java#L61-L97","documentation":"The optional subscription position params (initial-term-id, term-id, term-offset) must be supplied together as a complete set. If at least one is present on the channel URI but fewer than all three, the driver throws IllegalArgumentException. These params let a subscriber join a specific position; a partial set is ambiguous.","triggerScenarios":"Adding a subscription with a URI containing only one or two of: initial-term-id, term-id, term-offset, e.g. aeron:udp?...|initial-term-id=0|term-id=1 without term-offset.","commonSituations":"Hand-editing URIs to replay from a position and forgetting one param; code that appends params conditionally and skips a null/absent one.","solutions":["Include all three params (initial-term-id, term-id, term-offset) in the URI.","Omit all three if you do not need an explicit join position.","Build the URI from a helper that adds the trio atomically."],"exampleFix":"// before\n\"aeron:udp?endpoint=localhost:40456|initial-term-id=0|term-id=1\"\n// after\n\"aeron:udp?endpoint=localhost:40456|initial-term-id=0|term-id=1|term-offset=0\"","handlingStrategy":"validation","validationCode":"int count = 0;\nfor (String p : new String[]{\"initial-term-id\", \"term-id\", \"term-offset\"})\n    if (uriContains(uri, p)) count++;\nif (count != 0 && count != 3) throw new IllegalArgumentException(\"initial-term-id, term-id, term-offset must all be set together\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set or omit the three position params as a group.","Wrap position-resume URIs in a builder method that appends the trio atomically."],"tags":["aeron","channel-uri","subscription","config"],"backgroundTag":"missing-required-argument","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"}