FuelLabs/fuel-core · error · anyhow::Error

Either `first` or `last` should be provided

Error message

Either `first` or `last` should be provided

What it means

Error "Either `first` or `last` should be provided" thrown in FuelLabs/fuel-core.

Source

Thrown at crates/fuel-core/src/schema.rs:153

        }
        (_, _, None, None) => {
            return Err(anyhow!("The queries for the whole range is not supported").into())
        }
        (_, _, _, _) => { /* Other combinations are allowed */ }
    };

    query(
        after,
        before,
        first,
        last,
        |after: Option<SchemaKey>, before: Option<SchemaKey>, first, last| async move {
            let (count, direction) = if let Some(first) = first {
                (first, IterDirection::Forward)
            } else if let Some(last) = last {
                (last, IterDirection::Reverse)
            } else {
                return Err(anyhow!("Either `first` or `last` should be provided"))
            };

            let start;
            let end;

            if direction == IterDirection::Forward {
                start = after;
                end = before;
            } else {
                start = before;
                end = after;
            }

            let entries = entries(&start, direction)?;
            let mut has_previous_page = false;
            let mut has_next_page = false;

            // TODO: Add support of `skip` field for pages with huge list of entities with

View on GitHub (pinned to b9d4d170da)

When it happens

Trigger: Thrown at crates/fuel-core/src/schema.rs:153 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of FuelLabs/fuel-core@b9d4d170da (2026-08-16). Data as JSON: /api/errors/8abc1a55e8c956e3. Report an issue: GitHub.