cube-js/cube · error

this endpoint no longer returns `{key}`, so the deprecated p

Error message

this endpoint no longer returns `{key}`, so the deprecated paging flags cannot be honored — use --first/--after instead

What it means

rows_from extracts the row array from a list-endpoint JSON response using a key ("data") selected by the deprecated offset-paging flags. If the response no longer contains that key (the endpoint migrated to cursor paging and returns `items`), the CLI refuses to guess and errors instead of silently rendering a different page than requested.

Source

Thrown at rust/cube-cli/src/output.rs:143

        .map(|item| columns.iter().map(|(_, f)| field(item, f)).collect())
        .collect();
    table(&headers, cells);
}

/// The rows a list response should be rendered from: `key` when the caller
/// asked for one, otherwise the usual `items`/`data` resolution.
///
/// A requested `key` is strict. Falling back to `items` when it is missing
/// would silently reintroduce the bug this exists to fix — the day an
/// endpoint drops its deprecated `data`, `--limit 5` would quietly print the
/// whole cursor page instead. Fail with the replacement flags instead.
fn rows_from(response: &Value, key: Option<&str>) -> Result<Vec<Value>> {
    let Some(key) = key else {
        return Ok(items(response));
    };
    match response.get(key).and_then(Value::as_array) {
        Some(rows) => Ok(rows.clone()),
        None => bail!(
            "this endpoint no longer returns `{key}`, so the deprecated paging flags \
             cannot be honored — use --first/--after instead"
        ),
    }
}

pub fn success(message: &str) {
    println!("{} {}", "✓".green(), message);
}

#[cfg(test)]
mod tests {
    use super::*;
    use serde_json::json;

    #[test]
    fn items_prefers_the_canonical_field_over_the_deprecated_one() {
        // Lists that kept `data` as a deprecated alias return both; `items` wins.

View on GitHub (pinned to 7d981676b3)

Solutions

  1. Replace --offset/--limit with the cursor flags --first/--after
  2. Drop the paging flags entirely to render the canonical `items` page
  3. Update scripts/aliases that hardcode --offset/--limit
  4. Upgrade the CLI if your server version still expects offset paging and vice versa

Example fix

// before
cube cloud environments list --offset 20 --limit 10

// after
cube cloud environments list --first 10 --after <cursor>
Defensive patterns

Strategy: validation

Validate before calling

// before invoking the CLI, ensure flags are mutually consistent
if process.argv.includes("--offset") || process.argv.includes("--limit") {
  throw new Error("use --first/--after; --offset/--limit are deprecated");
}

Prevention

When it happens

Trigger: Calling a list command with the deprecated --offset/--limit flags against an endpoint whose response body has no `data` array (response.get("data") returns None or a non-array), i.e. the server dropped the legacy field.

Common situations: Scripts or aliases still passing --offset/--limit after the API deprecated offset paging; older CLI invocation patterns carried over to newer server deployments; endpoint migrated from offset paging to --first/--after cursor paging.

Related errors


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