{"record":{"id":"fe71e39d5197d1c4","repo":"apache/shardingsphere","slug":"invalid-batch-parameter-integer-length-for-tag-d","errorCode":null,"errorMessage":"Invalid batch parameter integer length for tag %d: %d","messagePattern":"Invalid batch parameter integer length for tag (.+?): (.+?)","errorType":"exception","errorClass":"FirebirdProtocolException","httpStatus":null,"severity":"error","filePath":"proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutor.java","lineNumber":170,"sourceCode":"            long result = Integer.toUnsignedLong(requestedBufferSize);\n            return 0L == result ? MAX_BUFFER_SIZE : Math.min(result, MAX_BUFFER_SIZE);\n        }\n        \n        private static void ensureClumpletHeaderReadable(final ByteBuf reader) {\n            if (reader.readableBytes() < 1 + WIDE_CLUMPLET_LENGTH_SIZE) {\n                throw new FirebirdProtocolException(\"Invalid batch parameters buffer\");\n            }\n        }\n        \n        private static void ensureClumpletValueReadable(final ByteBuf reader, final int tag, final int valueLength) {\n            if (valueLength < 0 || valueLength > reader.readableBytes()) {\n                throw new FirebirdProtocolException(\"Invalid batch parameter length for tag %d: %d\", tag, valueLength);\n            }\n        }\n        \n        private static int readIntegerValue(final ByteBuf reader, final int tag, final int valueLength) {\n            if (INTEGER_VALUE_LENGTH != valueLength) {\n                throw new FirebirdProtocolException(\"Invalid batch parameter integer length for tag %d: %d\", tag, valueLength);\n            }\n            return reader.readIntLE();\n        }\n    }\n}\n","sourceCodeStart":152,"sourceCodeEnd":176,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutor.java#L152-L176","documentation":"FirebirdProtocolException from readIntegerValue: batch parameter tags that carry an integer value (TAG_MULTIERROR, TAG_RECORD_COUNTS, TAG_BUFFER_BYTES_SIZE) must declare exactly 4 value bytes (INTEGER_VALUE_LENGTH). Any other declared length is rejected before the value is read.","triggerScenarios":"BatchParameters.parse() calls readIntegerValue(reader, tag, valueLength) for integer tags; valueLength != 4 throws 'Invalid batch parameter integer length for tag %d: %d'.","commonSituations":"a client encoding boolean flags as 1 byte instead of a 4-byte integer; a hand-rolled builder writing lengths in the wrong unit (e.g. bits or words); protocol-dialect confusion with older narrow clumplets.","solutions":["Encode every integer-valued batch parameter tag (multi-error, record counts, buffer bytes size) as exactly a 4-byte little-endian value with length field 4.","Do not compress boolean options to 1 byte; the protocol expects a full integer.","Use a reference client library implementation of the batch parameters block."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (SQLException e) {\n    if (e.getMessage().contains(\"integer length for tag\")) { throw new IllegalStateException(\"integer clumplet must be 4 bytes\", e); }\n    throw e;\n}","preventionTips":["Encode integer-valued tags (multierror, record counts, buffer size) as exactly 4-byte LE values.","Do not compact booleans to 1 byte in the batch parameters block."],"tags":["firebird","batch","clumplet","protocol","encoding"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}