aws-cli/1.11.13 Python/3.5.2 Linux/4.4.0-1013-aws botocore/1.4.70
See https://twitter.com/lampholder/status/835777466685927424 (which is now one of the top results when googling the error message).
Invalid length for parameter Key, value: 0, valid range: 1-inf
when you leave off --recursive is not a useful error message when it should either
or
I can't reproduce this using awscli 1.11.178 and you seem to be quite a few versions behind. When I try to run a similar command I get:
upload failed: local/ to s3://bucket/remote/ [Errno 21] Is a directory: 'path/to/local/'
Could you try upgrading your version of aws-cli and see if you're able to still reproduce this error? Thanks!
Closing due to inactivity. Please open a new issue if you are able to give reproduction steps with the latest version of the CLI.
I get that error message when trying to cp a directory to the root of the bucket with aws-cli/1.14.57 (Python/3.5.2 Linux/4.13.0-36-generic botocore/1.9.10).
To reproduce:
$aws s3 cp test-dir s3://bucket/ --storage-class STANDARD_IA
upload failed: test-dir/ to s3://bucket/ Parameter validation failed:
Invalid length for parameter Key, value: 0, valid range: 1-inf
If a non-root directory is given, I get the error:
upload failed: test-dir/ to s3://bucket/path [Errno 21] Is a directory: '/absolute/path/to/test-dir/'
Both error messages should indicate that directories are omitted and that '--recursive' should be used. I suggest:
upload failed: test-dir/ to s3://bucket/path [Errno 21] Is a directory: '/absolute/path/to/test-dir/' (requires '--recursive')
getting this bug as well using aws-cli/1.14.9 Python/2.7.13 Linux/4.9.85-38.58.amzn1.x86_64 botocore/1.8.13 and just as the original poster suggested, use of --recursive fixes it and it works normally.
aws s3 cp "snapshot/" s3://juniper-backup-bucket
this only outputs this error message: Invalid length for parameter Key, value: 0, valid range: 1-inf
aws s3 cp "snapshot/" s3://juniper-backup-bucket --recursive
this one works as desired and copies the directory over to my bucket.
Please reopen. As a new AWS user, running into that error and googling the error message leads users to this ticket.
This Developer Experience can be optimized a lot.
I've just ran into this error in a brand new environment on CircleCI.
$ aws --version
aws-cli/1.15.79 Python/3.7.0 Linux/4.4.0-130-generic botocore/1.10.78
The base image is circleci/python:3.7
, this is the full config, with a few paths changed:
docker:
- image: circleci/python:3.7
steps:
- checkout
- run:
name: Install awscli
command: sudo pip install awscli
- run:
name: Configure awscli
command: |
aws configure set aws_access_key_id $AWS_ACCESS_KEY
aws configure set aws_secret_access_key $AWS_SECRET_KEY
aws configure set region us-east-2
- run:
name: Deploy
command: aws s3 cp website/public s3://mybucket
I ssh'd into this environment, the dir path was valid and the aws s3 cp
command failed with
upload failed: (redacted) Parameter validation failed:
Invalid length for parameter Key, value: 0, valid range: 1-inf
Exited with code 1
Running the command again with --recursive
succeeded. Since I'm running pip install on a brand new environment I suppose this is the latest version of awscli. This should be more than enough to reproduce the error, please reopen.
I think @kyleknap wants a new issue to be opened if this is ever going to be fixed.
I found this GitHub ticket while googling the error message I got. I agree that it's completely useless. You really need to Google the message to even get an idea of what's wrong.
The default that comes on
brew install awscli
provides the not really descriptive error described above.
I got the same error while trying to run an s3 cp with the source being a local directory which was empty. I was accidental pointing at the wrong dir but the error message was non descriptive.
I got this error because i wasn't using --recursive option:
download failed: s3://test/platfom/utterances/ to lib/conversation/utterances/ [Errno 20] Not a directory: '/opt/bot/lib/conversation/utterances/.F11a5Fae' -> '/opt/bot/lib/conversation/utterances/'
Most helpful comment
Please reopen. As a new AWS user, running into that error and googling the error message leads users to this ticket.
This Developer Experience can be optimized a lot.