{"record":{"id":"8f748d2269efbb58","repo":"aeron-io/aeron","slug":"applicationspecificfeedback-length-must-be-equal-to-size-of","errorCode":null,"errorMessage":"applicationSpecificFeedback length must be equal to {SIZE_OF_LONG} bytes: length={length}","messagePattern":"applicationSpecificFeedback length must be equal to (.+?) bytes: length=(.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java","lineNumber":4393,"sourceCode":"            }\n\n            if (null == receiveChannelEndpointSupplier)\n            {\n                receiveChannelEndpointSupplier = Configuration.receiveChannelEndpointSupplier();\n            }\n\n            if (null == applicationSpecificFeedback)\n            {\n                applicationSpecificFeedback = Configuration.applicationSpecificFeedback();\n            }\n\n            if (null == receiverGroupTag)\n            {\n                if (applicationSpecificFeedback.length > 0)\n                {\n                    if (applicationSpecificFeedback.length != SIZE_OF_LONG)\n                    {\n                        throw new IllegalArgumentException(\n                            \"applicationSpecificFeedback length must be equal to \" + SIZE_OF_LONG +\n                            \" bytes: length=\" + applicationSpecificFeedback.length);\n                    }\n\n                    final UnsafeBuffer buffer = new UnsafeBuffer(applicationSpecificFeedback);\n                    receiverGroupTag = buffer.getLong(0, ByteOrder.LITTLE_ENDIAN);\n                }\n            }\n\n            if (null == receiveChannelEndpointThreadLocals)\n            {\n                receiveChannelEndpointThreadLocals = new ReceiveChannelEndpointThreadLocals();\n            }\n\n            if (null == congestionControlSupplier)\n            {\n                congestionControlSupplier = Configuration.congestionControlSupplier();\n            }","sourceCodeStart":4375,"sourceCodeEnd":4411,"githubUrl":"https://github.com/aeron-io/aeron/blob/6d60124e15e35c11b49ba2e3c2c2858a09a18803/aeron-driver/src/main/java/io/aeron/driver/MediaDriver.java#L4375-L4411","documentation":"Aeron throws this when an applicationSpecificFeedback value used to derive a receiver group tag is not exactly 8 bytes (the size of a long). The ASFB bytes are interpreted as a little-endian long to form the receiverGroupTag, so any other length is rejected at Context.conclude().","triggerScenarios":"Calling Context.applicationSpecificFeedback(byte[]) (or the corresponding builder method) with a non-empty array whose length != 8 while no explicit receiverGroupTag is set.","commonSituations":"Hand-crafting ASFB bytes from a string or UUID without padding/truncating to exactly 8 bytes; copying tag bytes from another protocol with different widths; passing a human-readable tag string like 'my-tag' (6 bytes).","solutions":["Pad or truncate your ASFB payload to exactly 8 bytes before setting it","Set Context.receiverGroupTag(long) instead and let Aeron encode the bytes","Use ByteBuffers.longToBytes / manual little-endian encoding to build the 8-byte array"],"exampleFix":"// before\ncontext.applicationSpecificFeedback(\"mytag\".getBytes());\n// after\nbyte[] asfb = new byte[SIZE_OF_LONG];\nByteBuffers.putLongL(asfb, 0, 0x6d79746167L);\ncontext.applicationSpecificFeedback(asfb);","handlingStrategy":"validation","validationCode":"if (asfb != null && asfb.length != 0 && asfb.length != 8) throw new IllegalArgumentException(\"applicationSpecificFeedback must be 8 bytes\");","typeGuard":"boolean isValidAsfb(byte[] b) { return b == null || b.length == 0 || b.length == Long.BYTES; }","tryCatchPattern":"try { ctx.applicationSpecificFeedback(asfb); ctx.conclude(); } catch (IllegalArgumentException e) { log.error(\"bad ASFB length\", e); }","preventionTips":["Always encode the tag from a long, not a raw string","Prefer Context.receiverGroupTag(long) over raw byte arrays","Unit-test ASFB encoding alongside driver startup"],"tags":["aeron","configuration","validation"],"backgroundTag":"invalid-argument-value","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"}