cube-js/cube · error

{} are deprecated and cannot be combined with --first/--afte

Error message

{} are deprecated and cannot be combined with --first/--after

What it means

paging_field resolves which response field a list command should render given the paging flags used. The API deprecated offset paging (--offset/--limit) in favor of cursor paging (--first/--after); the two address different pages of the same response, and mixing them would make endpoints either reject the request or silently honor only one. The CLI rejects the combination up front instead of printing a page the caller did not ask for.

Source

Thrown at rust/cube-cli/src/util.rs:106

/// honors just one (environments, user attributes). Reject it here instead,
/// so the CLI never prints a page the caller did not ask for.
///
/// Reading `data` is only ever right for a [`ListPaging::data_only`]
/// endpoint. Doing it everywhere "for uniformity" would be actively harmful:
/// on a query-sliced endpoint `items` is already the requested page and stays
/// so after `data` is dropped, whereas asking for `data` would then fail a
/// command the server still honors perfectly well.
pub fn paging_field(
    paging: ListPaging,
    deprecated_a: Option<u64>,
    deprecated_b: Option<u64>,
    first: Option<u64>,
    after: Option<&str>,
) -> Result<Option<&'static str>> {
    let uses_offset = deprecated_a.is_some() || deprecated_b.is_some();
    let uses_cursor = first.is_some() || after.is_some();
    if uses_offset && uses_cursor {
        bail!(
            "{} are deprecated and cannot be combined with --first/--after",
            paging.flags
        );
    }
    Ok((uses_offset && paging.data_only).then_some("data"))
}

/// Normalize a user-supplied Cube Cloud URL: trim whitespace and trailing
/// slashes, and default to `https://` when no scheme is given (reqwest
/// otherwise fails with "relative URL without a base").
pub fn normalize_url(url: &str) -> String {
    let url = url.trim().trim_end_matches('/');
    if url.is_empty() || url.contains("://") {
        url.to_string()
    } else {
        format!("https://{url}")
    }
}

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Remove the deprecated --offset/--limit flags and keep only --first/--after
  2. Or remove --first/--after and use only the deprecated flags if the endpoint still supports them (not recommended)
  3. Audit scripts/aliases for both sets of paging flags

Example fix

// before
cube cloud reports list --offset 0 --limit 20 --first 20

// after
cube cloud reports list --first 20 --after <cursor>
Defensive patterns

Strategy: validation

Validate before calling

# reject mixed paging flags before invoking
args = sys.argv
if ({"--offset", "--limit"} & set(args)) and ({"--first", "--after"} & set(args)):
    raise SystemExit("cannot mix deprecated --offset/--limit with --first/--after")

Prevention

When it happens

Trigger: Invoking a list command with at least one deprecated flag (--offset or --limit) AND at least one cursor flag (--first or --after) simultaneously.

Common situations: Scripts updated to add --first/--after without removing legacy --offset/--limit; shell aliases accumulating flags over time; users copying examples from old docs and new docs together.

Related errors


AI-assisted analysis of cube-js/cube@7d981676b3 (2026-09-02). Data as JSON: /api/errors/d771bb2e0bd54b20. Report an issue: GitHub.