aws-cli icon indicating copy to clipboard operation
aws-cli copied to clipboard

aws s3api list-object-versions: specifying --starting-token errors with "Cannot specify --no-paginate along with pagination arguments: --starting-token", even though --no-paginate is not set.

Open lxe opened this issue 9 years ago • 5 comments

❯ aws --version
aws-cli/1.11.76 Python/2.7.10 Darwin/16.5.0 botocore/1.5.3

aws s3api list-object-versions:

specifying --starting-token errors with :

Cannot specify --no-paginate along with pagination arguments: --starting-token

even though --no-paginate is not set.

Working:

aws s3api list-object-versions --bucket my-bucket --key my-prefix/
# works

Error:

aws s3api list-object-versions --bucket my-bucket --key my-prefix/ --starting-token foo/bar

Error during pagination: Cannot specify --no-paginate along with pagination arguments: --starting-token

I'm not specifying --no-paginate, yet still seeing the error. Possibly related to #2554

lxe avatar Apr 18 '17 17:04 lxe

Looks like we have a bad error message here we can try to clean up.

What's happening here is the CLI will normalize the pagination arguments so that they're the same across all services, so instead of having to know if a service uses --next-token, --next-marker, or for list-object-versions --key-marker we just standardize on --starting-token and map that internally to the real argument name (--next-token, --next-marker, etc)

In order to do this, we hide the real argument name so you don't see a confusing --starting-token and --next-token in our documentation.

We do support directly providing the real argument instead of --starting-token if you want. This is mostly for migrating to paginated APIs in a backwards compatible way. When that happens we turn off pagination. So what's happening here is that you're providing --key-marker (the CLI accepts prefix arguments so --key maps to --key-marker) which is turning off pagination. Note that --key-marker isn't documented. The error message is leaking an implementation detail that to turn off pagination we conceptually just set the --no-paginate argument.

From what I can tell, it looks like your intent is to use the --key argument as a way to filter down results that only have that prefix. You should be able to accomplish this by using --prefix instead of --key-marker.

Let me know if you have any questions/concerns.

jamesls avatar Apr 20 '17 17:04 jamesls

What are the other 'real argument' names we can use for other services e.g: elbv2 ?

andrewmyhre avatar Jul 07 '17 16:07 andrewmyhre

Alternatively how do we explicitly turn on pagination so the --starting-token argument works as expected?

andrewmyhre avatar Jul 07 '17 16:07 andrewmyhre

I'm getting the same error for aws-cli/2.0.48 Python/3.7.3 Linux/5.4.0-26-generic exe/x86_64.linuxmint.20.

oprogramador avatar Feb 19 '21 23:02 oprogramador

--starting-token= works after removing --limit

oprogramador avatar Feb 19 '21 23:02 oprogramador