SeaQL/sea-orm · error
Failed to get double array
Error message
Failed to get double array
What it means
This panic comes from `.expect("Failed to get double array")` in ProxyRow's PostgreSQL driver (src/driver/sqlx_postgres.rs:546). For columns typed FLOAT8[]/DOUBLE PRECISION[] (behind the `postgres-array` feature), the code decodes `Option<Vec<f64>>`; if sqlx cannot decode the array into Vec<f64> it panics. Usually the array element type is not truly float8, or the value is not an array at all.
Source
Thrown at src/driver/sqlx_postgres.rs:546
row.try_get::<Option<Vec<f32>>, _>(c.ordinal())
.expect("Failed to get float array")
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::Float(Some(val)))
.collect(),
)
}),
),
"FLOAT8" | "DOUBLE PRECISION" => {
Value::Double(row.try_get(c.ordinal()).expect("Failed to get double"))
}
#[cfg(feature = "postgres-array")]
"FLOAT8[]" | "DOUBLE PRECISION[]" => Value::Array(
sea_query::ArrayType::Double,
row.try_get::<Option<Vec<f64>>, _>(c.ordinal())
.expect("Failed to get double array")
.map(|vals| {
Box::new(
vals.into_iter()
.map(|val| Value::Double(Some(val)))
.collect(),
)
}),
),
"VARCHAR" | "CHAR" | "TEXT" | "NAME" => Value::String(
row.try_get::<Option<String>, _>(c.ordinal())
.expect("Failed to get string"),
),
#[cfg(feature = "postgres-array")]
"VARCHAR[]" | "CHAR[]" | "TEXT[]" | "NAME[]" => Value::Array(
sea_query::ArrayType::String,
row.try_get::<Option<Vec<String>>, _>(c.ordinal())
.expect("Failed to get string array")View on GitHub (pinned to e29bcd1b41)
Solutions
- Ensure the `postgres-array` feature is enabled consistently on both sea-orm and sqlx in Cargo.toml.
- Verify the column is genuinely float8[] (`SELECT array_typeof(col) FROM ...`) and cast in SQL (`col::float8[]`) if the element type differs.
- Update sea-orm and sqlx to matching versions and rebuild; array decoding changed between sqlx releases.
- Enable RUST_LOG=sqlx=debug to capture the real decode error and offending column before the expect.
- Replace the expect with an error mapped to DbErr::Custom including the column ordinal.
Example fix
// Cargo.toml
// before
sea-orm = { version = "1", features = ["sqlx-postgres"] }
// after
sea-orm = { version = "1", features = ["sqlx-postgres", "postgres-array"] } Defensive patterns
Strategy: validation
Validate before calling
// Verify array element type before reading: // SELECT array_typeof(col) FROM t LIMIT 1; -- expect 'double precision' // Or cast: SELECT col::float8[] FROM ...
Type guard
fn is_float8_array_col(c: &ProxyColumn) -> bool {
matches!(c.ty.as_str(), "FLOAT8[]" | "DOUBLE PRECISION[]")
} Try / catch
std::panic::catch_unwind(|| read_row(row))
.map_err(|p| DbErr::Custom(format!("float8[] decode panic: {p:?}")))?; Prevention
- Enable the `postgres-array` feature on sea-orm and sqlx.
- Cast arrays in SQL (`::float8[]`) when the element type is uncertain.
- Test array columns after every schema migration.
- Keep sea-orm/sqlx versions aligned.
- Use array_typeof checks in data validation queries.
When it happens
Trigger: Calling `ConnExec`/query through the proxy driver against a float8[] column when the underlying value is a scalar, a text array (e.g. produced by array_to_string), or an array of another numeric type (numeric[] cast to float8[] only in the type name), or the `postgres-array` sqlx feature isn't enabled so arrays fail to decode.
Common situations: Missing `postgres-array` feature flag on the sqlx/sea-orm dependency, expressions like array_agg returning a differently typed array, comparing the schema's cached column metadata against a changed table, or Postgres extension types that report as float8[] but decode differently.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Failed to get float array
- Failed to get double array
- Failed to get string array
- Failed to get string array
- Failed to get float
AI-assisted analysis of SeaQL/sea-orm@e29bcd1b41 (2026-09-10).
Data as JSON: /api/errors/d57b83a07295833b.
Report an issue: GitHub.