hasura/graphql-engine · error · Error

{value} is not a valid limit value

Error message

{value} is not a valid limit value

What it means

Pagination limit arguments in the IR must fall within the accepted numeric range for the limit field. When the provided limit value fails validation (e.g. exceeds the maximum allowed or is otherwise rejected by the argument parser), this error echoes the offending value. It prevents unbounded or invalid limits from reaching data sources.

Source

Thrown at v3/crates/graphql/ir/src/error.rs:58

    #[error("The global ID {encoded_value:} couldn't be decoded due to {decoding_error:}")]
    FailureDecodingGlobalId {
        encoded_value: String,
        decoding_error: String,
    },

    #[error("Unexpected value: expecting {expected_kind:}, but found: {found:}")]
    UnexpectedValue {
        expected_kind: &'static str,
        found: json::Value,
    },

    #[error("'{name:}' is not a valid GraphQL name.")]
    TypeFieldInvalidGraphQlName { name: String },

    #[error("'{alias:} is not a valid alias")]
    InvalidAlias { alias: String },

    #[error("{value} is not a valid limit value")]
    InvalidLimitValue { value: u32 },

    #[error("{value} is not a valid offset value")]
    InvalidOffsetValue { value: u32 },

    #[error("field '{field_name:} not found in entity representation")]
    FieldNotFoundInEntityRepresentation { field_name: FieldName },

    #[error(
        "order_by expects a list of input objects with exactly one key-value pair per input object. Please split the input object with multiple key-value pairs into a list of single key-value pair objects."
    )]
    OrderByObjectShouldExactlyHaveOneKeyValuePair,

    #[error("missing non-nullable argument {argument_name:} for field {field_name:}")]
    MissingNonNullableArgument {
        argument_name: String,
        field_name: String,
    },

View on GitHub (pinned to 724551b9ae)

Solutions

  1. Lower the requested limit to the maximum allowed by the field/connection (check the schema's constraint directives)
  2. If you operate the server, raise the configured max limit or add explicit constraint docs to the schema
  3. Clamp limit inputs client-side before sending the query

Example fix

# before
query {{ items(limit: 100000) {{ id }} }}

# after
query {{ items(limit: 100) {{ id }} }}
Defensive patterns

Strategy: validation

Validate before calling

const MAX_LIMIT = 100;
const limit = Math.min(requested, MAX_LIMIT);

Type guard

function isValidLimit(v: number, max = 100): v is number {{
  return Number.isInteger(v) && v > 0 && v <= max;
}}

Try / catch

try {{
  await fetchItems({{ limit }});
}} catch (e: any) {{
  if (/not a valid limit value/.test(e.message)) {{
    return fetchItems({{ limit: 100 }}); // fallback to max
  }}
  throw e;
}}

Prevention

When it happens

Trigger: Passing a limit argument larger than the configured/maximum allowed limit for a connection or field, or a value that the limit parser rejects while building IR from the request.

Common situations: Clients requesting limit: 100000 against a server capped at e.g. 100; configuration changes lowering max limits while clients keep old defaults; UI pagination components sending unbounded limits.

Related errors


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