{"record":{"id":"c3312882ce294f62","repo":"apache/shardingsphere","slug":"can-not-find-value-s-in-new-parameters-bound-fl","errorCode":null,"errorMessage":"Can not find value `%s` in new parameters bound flag.","messagePattern":"Can not find value `(.+?)` in new parameters bound flag\\.","errorType":"exception","errorClass":"MySQLProtocolException","httpStatus":null,"severity":"error","filePath":"database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlag.java","lineNumber":50,"sourceCode":"    \n    PARAMETER_TYPE_NOT_EXIST(0);\n    \n    private final int value;\n    \n    /**\n     * Value of new parameters bound flag.\n     *\n     * @param value value\n     * @return new parameters bound flag\n     * @throws MySQLProtocolException MySQL protocol exception\n     */\n    public static MySQLNewParametersBoundFlag valueOf(final int value) {\n        for (MySQLNewParametersBoundFlag each : values()) {\n            if (value == each.value) {\n                return each;\n            }\n        }\n        throw new MySQLProtocolException(\"Can not find value `%s` in new parameters bound flag.\", value);\n    }\n}\n","sourceCodeStart":32,"sourceCodeEnd":53,"githubUrl":"https://github.com/apache/shardingsphere/blob/e952770a215630a3659c75d64369168cd3e26b82/database/protocol/dialect/mysql/src/main/java/org/apache/shardingsphere/database/protocol/mysql/constant/MySQLNewParametersBoundFlag.java#L32-L53","documentation":"Thrown by MySQLNewParametersBoundFlag.valueOf(int) when the value is neither 0 (PARAMETER_COUNT_AVAILABLE) nor 1 (PARAMETER_COUNT_NOT_AVAILABLE). This flag appears in COM_STMT_EXECUTE responses parsing; any other byte means the packet stream is corrupted or a new protocol value was introduced.","triggerScenarios":"Parsing a binary protocol packet whose new-parameters-bound flag byte is > 1 — typically after earlier bytes of the packet were misparsed, leaving the reader misaligned, or from a malformed/malicious client.","commonSituations":"Proxy reading a MySQL stream that is out of sync (wrong packet boundary handling after a large payload, compression framing bug), non-MySQL clients connecting to the MySQL port, or protocol changes in very new MySQL versions.","solutions":["Verify the client is a real MySQL client speaking a supported protocol version","Check for stream desynchronization: enable packet-level logging and confirm lengths/payload boundaries of preceding packets","Reproduce with a stock mysql client; if it works, the failing client's packet construction is the suspect","Report an upstream bug if a standard client reliably produces flag values other than 0/1"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// if you build MySQL binary packets, assert the flag before relying on valueOf\nint flagByte = buffer.readUnsignedByte();\nif (flagByte != 0 && flagByte != 1) {\n    throw new IllegalStateException(\"stream desync: new-params-bound flag=\" + flagByte);\n}\nMySQLNewParametersBoundFlag flag = MySQLNewParametersBoundFlag.valueOf(flagByte);","typeGuard":null,"tryCatchPattern":"try {\n    MySQLNewParametersBoundFlag.valueOf(value);\n} catch (MySQLProtocolException ex) {\n    // value outside {0,1}: treat the connection as corrupted and close it;\n    // do not resync mid-connection for binary protocol packets\n    connection.closeDueToProtocolError(ex);\n}","preventionTips":["Only send 0/1 for the new-parameters-bound flag in generated COM_STMT_EXECUTE payloads","Validate packet framing (sequence ids, lengths) before parsing fields to avoid downstream misreads"],"tags":["mysql","protocol","binary-protocol","enum-lookup","packet-parsing"],"backgroundTag":null,"analyzedSha":"e952770a215630a3659c75d64369168cd3e26b82","analyzedAt":"2026-08-14T13:54:53.392Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}