hasura/graphql-engine · error

movie_id out of range

Error message

movie_id out of range

What it means

In the custom-connector example, the `movie_id` argument to the `actors_by_movie` model was provided as an Int64 that doesn't fit in i32, so an expect() panics during query planning.

Source

Thrown at v3/crates/custom-connector/src/query/relational.rs:503

// return types for tables, with columns / data we don't current support filtered out
fn get_table_provider(
    collection_name: &ndc_models::CollectionName,
    arguments: &BTreeMap<ndc_models::ArgumentName, RelationalLiteral>,
    state: &AppState,
) -> datafusion::error::Result<Arc<dyn TableProvider>> {
    let (rows, collection_fields) = match collection_name.as_str() {
        "actors" => (
            crate::collections::actors::rows(&BTreeMap::new(), state)
                .map_err(|e| DataFusionError::Internal(e.1.0.message))?,
            crate::types::actor::definition().fields,
        ),
        "actors_by_movie" => {
            let movie_id_int: i32 = arguments
                .get("movie_id")
                .and_then(|v| match v {
                    RelationalLiteral::Int64 { value } => {
                        Some(i32::try_from(*value).expect("movie_id out of range"))
                    }
                    _ => None,
                })
                .ok_or_else(|| {
                    DataFusionError::Internal(
                        "actors_by_movie requires a movie_id argument".to_string(),
                    )
                })?;

            (
                crate::collections::actors_by_movie::rows_inner(movie_id_int, state),
                crate::types::actor::definition().fields,
            )
        }
        "countries" => (
            crate::collections::countries::rows(&BTreeMap::new(), state)
                .map_err(|e| DataFusionError::Internal(e.1.0.message))?
                .iter()

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Pass a movie_id within i32 range (-2147483648..=2147483647)
  2. Change the argument to i64 in the connector instead of try_from+expect
  3. Return a proper DataFusionError instead of panicking if you own this code

Example fix

// before
.oku003e(i32::try_from(*value).expect("movie_id out of range"))
// after
let v = i32::try_from(*value).map_err(|_| DataFusionError::Execution("movie_id out of range".into()))?;
Defensive patterns

Strategy: validation

Validate before calling

if (!Number.isInteger(movieId) || movieId < -2147483648 || movieId > 2147483647) throw new RangeError('movie_id out of i32 range');

Type guard

const isI32 = (n: number): n is number => Number.isInteger(n) && n >= -2147483648 && n <= 2147483647;

Try / catch

Wrap model calls and catch the panic in the connector boundary, returning a user-facing range error.

Prevention

When it happens

Trigger: Calling the `actors_by_movie` table-valued model with movie_id outside i32 range (e.g. 3000000000).

Common situations: Example/demo queries with arbitrary large IDs; GraphQL Int being coerced to a large i64; fuzz or test inputs exceeding int4 range.

Related errors


AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28). Data as JSON: /api/errors/90f4bed5de9e5f08. Report an issue: GitHub.