{"record":{"id":"d771bb2e0bd54b20","repo":"cube-js/cube","slug":"are-deprecated-and-cannot-be-combined-with-fi","errorCode":null,"errorMessage":"{} are deprecated and cannot be combined with --first/--after","messagePattern":"(.+?) are deprecated and cannot be combined with --first/--after","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"rust/cube-cli/src/util.rs","lineNumber":106,"sourceCode":"/// honors just one (environments, user attributes). Reject it here instead,\n/// so the CLI never prints a page the caller did not ask for.\n///\n/// Reading `data` is only ever right for a [`ListPaging::data_only`]\n/// endpoint. Doing it everywhere \"for uniformity\" would be actively harmful:\n/// on a query-sliced endpoint `items` is already the requested page and stays\n/// so after `data` is dropped, whereas asking for `data` would then fail a\n/// command the server still honors perfectly well.\npub fn paging_field(\n    paging: ListPaging,\n    deprecated_a: Option<u64>,\n    deprecated_b: Option<u64>,\n    first: Option<u64>,\n    after: Option<&str>,\n) -> Result<Option<&'static str>> {\n    let uses_offset = deprecated_a.is_some() || deprecated_b.is_some();\n    let uses_cursor = first.is_some() || after.is_some();\n    if uses_offset && uses_cursor {\n        bail!(\n            \"{} are deprecated and cannot be combined with --first/--after\",\n            paging.flags\n        );\n    }\n    Ok((uses_offset && paging.data_only).then_some(\"data\"))\n}\n\n/// Normalize a user-supplied Cube Cloud URL: trim whitespace and trailing\n/// slashes, and default to `https://` when no scheme is given (reqwest\n/// otherwise fails with \"relative URL without a base\").\npub fn normalize_url(url: &str) -> String {\n    let url = url.trim().trim_end_matches('/');\n    if url.is_empty() || url.contains(\"://\") {\n        url.to_string()\n    } else {\n        format!(\"https://{url}\")\n    }\n}","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/cube-js/cube/blob/7d981676b36392fec34088b9afab6bdcad40207c/rust/cube-cli/src/util.rs#L88-L124","documentation":"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.","triggerScenarios":"Invoking a list command with at least one deprecated flag (--offset or --limit) AND at least one cursor flag (--first or --after) simultaneously.","commonSituations":"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.","solutions":["Remove the deprecated --offset/--limit flags and keep only --first/--after","Or remove --first/--after and use only the deprecated flags if the endpoint still supports them (not recommended)","Audit scripts/aliases for both sets of paging flags"],"exampleFix":"// before\ncube cloud reports list --offset 0 --limit 20 --first 20\n\n// after\ncube cloud reports list --first 20 --after <cursor>","handlingStrategy":"validation","validationCode":"# reject mixed paging flags before invoking\nargs = sys.argv\nif ({\"--offset\", \"--limit\"} & set(args)) and ({\"--first\", \"--after\"} & set(args)):\n    raise SystemExit(\"cannot mix deprecated --offset/--limit with --first/--after\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on --first/--after across all scripts and aliases","Grep automation for --offset/--limit and remove them","Never append cursor flags to commands that already carry offset flags"],"tags":["cli","pagination","deprecated-flags","argument-parsing","validation"],"backgroundTag":"deprecated-paging-flags","analyzedSha":"7d981676b36392fec34088b9afab6bdcad40207c","analyzedAt":"2026-09-02T03:45:10.400Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}