{"record":{"id":"130df4159fadcba6","repo":"apache/shardingsphere","slug":"wrong-version-of-batch-parameters-block-d-should","errorCode":null,"errorMessage":"Wrong version of batch parameters block %d, should be %d","messagePattern":"Wrong version of batch parameters block (.+?), should be (.+?)","errorType":"exception","errorClass":"InvalidBatchParameterVersionException","httpStatus":null,"severity":"error","filePath":"proxy/frontend/dialect/firebird/src/main/java/org/apache/shardingsphere/proxy/frontend/firebird/command/query/batch/FirebirdBatchCreateCommandExecutor.java","lineNumber":121,"sourceCode":"        private final int version;\n        \n        private final long bufferSize;\n        \n        private final boolean recordCounts;\n        \n        private final boolean multiError;\n        \n        // private final int blobPolicy;\n        \n        static BatchParameters parse(final ByteBuf batchParametersBuffer) {\n            if (null == batchParametersBuffer || !batchParametersBuffer.isReadable()) {\n                // return new BatchParameters(BATCH_VERSION_1, DEFAULT_BUFFER_SIZE, false, false, BLOB_STREAM);\n                return new BatchParameters(BATCH_VERSION_1, DEFAULT_BUFFER_SIZE, false, false);\n            }\n            ByteBuf reader = batchParametersBuffer.duplicate();\n            int version = reader.readUnsignedByte();\n            if (BATCH_VERSION_1 != version) {\n                throw new InvalidBatchParameterVersionException(version, BATCH_VERSION_1);\n            }\n            long bufferSize = DEFAULT_BUFFER_SIZE;\n            boolean recordCounts = false;\n            boolean multiError = false;\n            // int blobPolicy = BLOB_STREAM;\n            while (reader.isReadable()) {\n                ensureClumpletHeaderReadable(reader);\n                int tag = reader.readUnsignedByte();\n                int valueLength = reader.readIntLE();\n                ensureClumpletValueReadable(reader, tag, valueLength);\n                if (TAG_MULTIERROR == tag) {\n                    multiError = 0 != readIntegerValue(reader, tag, valueLength);\n                } else if (TAG_RECORD_COUNTS == tag) {\n                    recordCounts = 0 != readIntegerValue(reader, tag, valueLength);\n                } else if (TAG_BUFFER_BYTES_SIZE == tag) {\n                    bufferSize = getBufferSize(readIntegerValue(reader, tag, valueLength));\n                } else if (TAG_BLOB_POLICY == tag) {\n                    // int requestedBlobPolicy = readIntegerValue(reader, tag, valueLength);","sourceCodeStart":103,"sourceCodeEnd":139,"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#L103-L139","documentation":"InvalidBatchParameterVersionException thrown while parsing the batch parameters clumplet buffer: the first byte is the batch block version and only BATCH_VERSION_1 is accepted. A different first byte means the client speaks a newer (or corrupted) batch parameters layout the proxy cannot parse.","triggerScenarios":"BatchParameters.parse() reads reader.readUnsignedByte() from a readable batch parameters buffer and compares against BATCH_VERSION_1; any other value (e.g. version 2 from a newer Firebird wire protocol) throws.","commonSituations":"a client built against Firebird 5 batch implementation details connecting to a proxy that only implements version 1; a packet builder that omits or shifts the version byte, making the next byte be read as the version; partial buffer truncation.","solutions":["Pin the client to Firebird wire/batch protocol version 1 (e.g. Jaybird default for protocol 13 batches).","If implementing the wire protocol, ensure the batch parameters clumplet starts with the version byte 1 followed by tag clumplets (tag byte + 4-byte little-endian length + value).","Upgrade the ShardingSphere proxy to a version that supports the newer batch parameters version if your client requires it."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"catch (SQLException e) {\n    if (e.getMessage().contains(\"Wrong version of batch parameters\")) {\n        // downgrade: send an empty/default batch parameters block (version 1 semantics)\n        sendCreateBatchWithDefaultParams(stmtHandle);\n    } else throw e;\n}","preventionTips":["Let the driver build the batch parameters block; do not serialize it manually.","Pin client and server to the same Firebird protocol generation."],"tags":["firebird","batch","clumplet","version","protocol"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}