MySQL client error raised when mysql_stmt_send_long_data is used on a parameter that is not declared as a string or binary type.
MySQL Error 2035: CR_INVALID_BUFFER_USE occurs when you call mysql_stmt_send_long_data on a placeholder bound to a non-string or non-binary column. Rebind the parameter with a BLOB, TEXT, or VARBINARY type or avoid mysql_stmt_send_long_data entirely to resolve the issue.
Can't send long data for non-string/non-binary data types (parameter: %d)
The MySQL client library raises error 2035 when mysql_stmt_send_long_data attempts to stream data into a prepared-statement placeholder that is bound to an integer, date, or other fixed-length type. Only placeholders bound as string or binary types can accept long data chunks.
Because the wire protocol expects a fixed number of bytes for non-string data, the client stops the transmission and surfaces CR_INVALID_BUFFER_USE.
The server never receives the packet, so the failure is purely client side.
The error shows up during bulk loads, file uploads, or blob inserts where developers split payloads into chunks via mysql_stmt_send_long_data.
It can surface in C, C++, PHP (mysqli_stmt_send_long_data), Go, and any language that wraps the native C API.
Developers often encounter the issue after changing a column from TEXT to INT but forgetting to update the binding code, or when copy-pasting sample code that uses long-data streaming for every parameter.
Leaving the bug unfixed stops data from reaching the database, breaks ETL pipelines, and may cause silent data loss if the error is swallowed by retry logic.
Correct binding protects data integrity and boosts application stability.
Using mysql_stmt_send_long_data on a parameter bound as MYSQL_TYPE_LONG, MYSQL_TYPE_LONGLONG, DATE, or any non-string type triggers the error immediately.
Mismatched bind type declarations due to schema changes are another driver.
Altering a column without updating the client binding creates an implicit mismatch.
First, call mysql_stmt_bind_param with the correct MYSQL_TYPE_STRING, MYSQL_TYPE_VAR_STRING, or MYSQL_TYPE_BLOB buffer_type for the placeholder that will receive long data.
If the column must remain numeric, stop using mysql_stmt_send_long_data and instead place the entire numeric value in the input buffer before mysql_stmt_execute.
Uploading a CSV where a numeric column is mistakenly streamed as long data - change the bind type to string or send the number in one piece.
Storing a large JSON document in a TEXT column renamed to JSON but keeping the old INT bind - switch buffer_type to MYSQL_TYPE_JSON or MYSQL_TYPE_STRING.
Keep bind code in one module and regenerate it automatically when the schema changes.
Use descriptive enums rather than hard-coded integers for buffer types.
Write unit tests that prepare statements and assert successful mysql_stmt_send_long_data calls to catch type mismatches early.
Error 2034 (CR_MALFORMED_PACKET) occurs when packet sizes are incorrect - often the next error after fixing buffer types.
Error 2055 (CR_SERVER_LOST) indicates network loss during long-data streaming - adjust net_write_timeout and retry logic.
.
Error 2035 originates in the MySQL client library before any packet reaches the server.
No. Only string and binary types accept streamed chunks. Send numeric values in a single buffer.
No. The error is independent of packet size. It is solely about buffer type mismatch.
Galaxy’s AI copilot detects mismatched bind types while you write C or Go snippets, suggesting the correct MYSQL_TYPE_ constant and avoiding CR_INVALID_BUFFER_USE.