Skip to content

List commands silently return only the first page (e.g. cf workers list returns 10 of 46) #20

Closed

Description

@eminsnow

Summary

cf workers list is described as "List all Workers for an account." On an account with 46 Workers it returns 10, and nothing in the output indicates that the result is incomplete. The API reports result_info.total_count: 46, but cf neither fetches the remaining pages nor surfaces the pagination info.

--page / --per-page work (--per-page 50 returns all 46), so this is about the default behaviour. A silently truncated JSON array looks complete. A human can miss that, and an agent almost certainly will: asked "which Workers exist?", it will answer confidently with 10 of 46.

Reproduction

On an account with more than 10 Workers and more than 20 KV namespaces:

cf workers list -q | jq length                       # 10
cf workers list -q --per-page 50 | jq length         # 46

cf kv namespaces list -q | jq length                 # 20
cf kv namespaces list -q --per-page 100 | jq length  # 49

Calling the same endpoint directly shows the pagination info that cf drops:

curl -s -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  "https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/workers" | jq -c .result_info
# {"page":1,"per_page":10,"count":10,"total_count":46}

KV namespaces: {"count":20,"page":1,"per_page":20,"total_count":49,"total_pages":3}

Expected

One of:

  1. When --page is not passed, fetch all pages (matches "List all ..."), or
  2. Keep single-page output but make the truncation visible, e.g. a stderr note such as showing 10 of 46; use --page/--per-page.

Environment

  • cf 1.0.0-beta.5 (npm), Node v22.18.0, macOS arm64
  • Auth via CLOUDFLARE_API_TOKEN

Activity

  1. added theissue type on Sep 29, 2026
  2. petebacondarwin commented on Nov 1, 2026

    @petebacondarwin
    Collaborator

    PR #447 exposes another consequence of dropping pagination metadata: callers cannot obtain the opaque tokens needed to request the next page or save a checkpoint.

    From the review thread:

    • cf email-domains changes loses result_info.next_cursor and result_info.has_more. Its documented polling/checkpoint flow requires both. Its required top-level platform data is also discarded by API-envelope unwrapping.
    • cf billing spend-policies activity list loses result_info.cursor, the opaque token for the next page.

    The API client retains result_info for array responses, but formatOutput() prints only the array. A single-page output policy still needs to expose the continuation metadata so callers can paginate manually. An envelope-preservation fix also needs to consider top-level response fields such as platform, which are dropped before formatting.

    Tracking these cases here and resolving the PR review thread in favor of this issue. Verified against PR commit c4737ec55b20c46e67a8273ef3ea50cc012230e9 and pinned OpenAPI revision 319dc756af2a642b3122b4db7e3b79ac1fbec7d8.

  3. petebacondarwin commented on Nov 4, 2026

    @petebacondarwin
    Collaborator

    Resolved by #478, merged as f3ebc1e.

    cf retains single-page JSON stdout and now exposes the API's non-empty result_info on stderr, including page counts, totals, and continuation cursors. Callers can use the endpoint's page/cursor flags to continue; --quiet intentionally suppresses this metadata notice.

    The remaining follow-up about cf email-domains changes losing top-level platform data has been moved to #510. Closing this issue as completed for its original pagination visibility problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions