Skip to content

--per-page is not validated (0, negative, non-numeric) and endpoint maximums are not advertised #99

Closed

Description

@joeblew999

cf version: 1.0.0-beta.5, macOS

What happens: --per-page values that are invalid or out of range aren't rejected. Depending on the command, cf silently returns a wrong result or fails with a raw API error.

Command Result
cf workers list --per-page 0 1 item, exit 0
cf workers list --per-page -5 1 item, exit 0
cf workers list --per-page abc flag ignored: 10 items (the default), exit 0
cf d1 list --per-page abc [7400] Invalid property: per_page => Expected number, received nan, exit 1
cf pages projects list --per-page 100 [8000024] Invalid list options provided, exit 1: the endpoint's maximum isn't advertised by the flag

Expected: validate --per-page locally (a positive integer within the endpoint's documented maximum) and report a usage error; show the maximum in --help.

Related: #20 (lists silently return only the first page).

Found while evaluating cf for a dev workflow: https://github.com/joeblew999/cf-cli-test (FINDINGS.md, findings/).

Activity

  1. penalosa commented on Oct 2, 2026

    @penalosa
    Collaborator

    After a little bit of investigation, this is an upstream yargs bug with validation number types: yargs/yargs#1079.

    Over time, we hope to improve the API error messaging here.

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

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions