diesel-rs/diesel · error
Hit a type that should be unsupported in libmysqlclient. If…
Error message
Hit a type that should be unsupported in libmysqlclient. If you ever see this error, they probably have added support for one of those types. Please open an issue at the diesel github repo in this case.
What it means
In diesel's MySQL bind conversion (`From<MysqlType>` for bind types), certain libmysqlclient field types (MYSQL_TYPE_VARCHAR, ENUM, SET, GEOMETRY) are considered unsupported by diesel's type mapping, so the `From` impl panics with `unimplemented!`. The message says libmysqlclient presumably added support for a type diesel doesn't map yet.
Solutions
- Upgrade diesel to the latest version — type mappings for these client types may have been added.
- Avoid selecting unsupported column types (ENUM/SET/GEOMETRY) directly; cast them in SQL (e.g. `CAST(col AS CHAR)`) or change the schema column type to VARCHAR/TEXT.
- Pin/align server and connector versions so columns report standard types (e.g. use VARCHAR instead of ENUM).
- Report the server/client version and type at https://github.com/diesel-rs/diesel as the message requests.
Example fix
// before
let rows: Vec<(GeometricColumn,)> = users.select(geometry_col).load(&mut conn)?;
// after
let rows: Vec<(String,)> = users.select(sql::<Text>("CAST(geometry_col AS CHAR)")).load(&mut conn)?; Defensive patterns
Strategy: validation
Validate before calling
// avoid selecting ENUM/SET/GEOMETRY columns directly; cast in SQL
let names: Vec<String> = diesel::dsl::sql::<diesel::sql_types::Text>("CAST(role AS CHAR)")
.load(&mut conn)?; Prevention
- Prefer VARCHAR/TEXT columns over ENUM/SET in MySQL schemas.
- Cast GEOMETRY columns to text when selecting with diesel.
- Keep server, mysqlclient, and diesel versions aligned and diesel updated.
When it happens
Trigger: A query on MySQL/MariaDB returns (or binds) a column whose client-reported type is one of VARCHAR/ENUM/SET/GEOMETRY while diesel converts the field type for row binding — i.e. selecting such columns with a mismatched Rust type mapping, usually against a newer or exotic server version.
Common situations: MariaDB servers reporting columns as MYSQL_TYPE_VARCHAR instead of the expected type; selecting GEOMETRY columns without the right crate/feature; version drift between server, mysqlclient, and diesel; using `text`/`blob` type aliases that map unexpectedly on a given server.
Related errors
- Unable to perform MySQL global initialization
- You've reached an impossible internal state. If you ever…
AI-assisted analysis of diesel-rs/diesel@6fa6ed01b2 (2026-09-07).
Data as JSON: /api/errors/ebf551180059aa11.
Report an issue: GitHub.
Appendix: source
Thrown at diesel/src/mysql_like/connection/bind.rs:804
enum_field_types::MYSQL_TYPE_YEAR => unreachable!(
"The year type should have set the unsigned flag. If you ever \
see this error message, something has gone very wrong. Please \
open an issue at the diesel github repo in this case"
),
// Null value
enum_field_types::MYSQL_TYPE_NULL => unreachable!(
"We ensure at the call side that we do not hit this type here. \
If you ever see this error, something has gone very wrong. \
Please open an issue at the diesel github repo in this case"
),
// Those exist in libmysqlclient
// but are just not supported
//
enum_field_types::MYSQL_TYPE_VARCHAR
| enum_field_types::MYSQL_TYPE_ENUM
| enum_field_types::MYSQL_TYPE_SET
| enum_field_types::MYSQL_TYPE_GEOMETRY => {
unimplemented!(
"Hit a type that should be unsupported in libmysqlclient. If \
you ever see this error, they probably have added support for \
one of those types. Please open an issue at the diesel github \
repo in this case."
)
}
enum_field_types::MYSQL_TYPE_NEWDATE
| enum_field_types::MYSQL_TYPE_TIME2
| enum_field_types::MYSQL_TYPE_DATETIME2
| enum_field_types::MYSQL_TYPE_TIMESTAMP2 => unreachable!(
"The mysql documentation states that these types are \
only used on the server side, so if you see this error \
something has gone wrong. Please open an issue at \
the diesel github repo."
),
// depending on the bindings version
// there might be no unlisted field typeView on GitHub (pinned to 6fa6ed01b2)