{"record":{"id":"807800dea930def3","repo":"cube-js/cube","slug":"this-endpoint-no-longer-returns-key-so-the-de","errorCode":null,"errorMessage":"this endpoint no longer returns `{key}`, so the deprecated paging flags cannot be honored — use --first/--after instead","messagePattern":"this endpoint no longer returns `(.+?)`, so the deprecated paging flags cannot be honored — use --first/--after instead","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cube-cli/src/output.rs","lineNumber":143,"sourceCode":"        .map(|item| columns.iter().map(|(_, f)| field(item, f)).collect())\n        .collect();\n    table(&headers, cells);\n}\n\n/// The rows a list response should be rendered from: `key` when the caller\n/// asked for one, otherwise the usual `items`/`data` resolution.\n///\n/// A requested `key` is strict. Falling back to `items` when it is missing\n/// would silently reintroduce the bug this exists to fix — the day an\n/// endpoint drops its deprecated `data`, `--limit 5` would quietly print the\n/// whole cursor page instead. Fail with the replacement flags instead.\nfn rows_from(response: &Value, key: Option<&str>) -> Result<Vec<Value>> {\n    let Some(key) = key else {\n        return Ok(items(response));\n    };\n    match response.get(key).and_then(Value::as_array) {\n        Some(rows) => Ok(rows.clone()),\n        None => bail!(\n            \"this endpoint no longer returns `{key}`, so the deprecated paging flags \\\n             cannot be honored — use --first/--after instead\"\n        ),\n    }\n}\n\npub fn success(message: &str) {\n    println!(\"{} {}\", \"✓\".green(), message);\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n    use serde_json::json;\n\n    #[test]\n    fn items_prefers_the_canonical_field_over_the_deprecated_one() {\n        // Lists that kept `data` as a deprecated alias return both; `items` wins.","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cube-cli/src/output.rs#L125-L161","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Replace --offset/--limit with the cursor flags --first/--after","Drop the paging flags entirely to render the canonical `items` page","Update scripts/aliases that hardcode --offset/--limit","Upgrade the CLI if your server version still expects offset paging and vice versa"],"exampleFix":"// before\ncube cloud environments list --offset 20 --limit 10\n\n// after\ncube cloud environments list --first 10 --after <cursor>","handlingStrategy":"validation","validationCode":"// before invoking the CLI, ensure flags are mutually consistent\nif process.argv.includes(\"--offset\") || process.argv.includes(\"--limit\") {\n  throw new Error(\"use --first/--after; --offset/--limit are deprecated\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use --first/--after cursor paging exclusively","Purge --offset/--limit from scripts, aliases, and CI configs","Re-check list commands after server upgrades that drop the legacy `data` field"],"tags":["cli","pagination","deprecated-flags","api-migration"],"backgroundTag":"deprecated-paging-flags","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}