Skip to content

r2 object put option conflict: --env and --expires #10921

@orlade

Description

@orlade

What versions & operating system are you using?

System:
OS: macOS 26.0.1
CPU: (10) arm64 Apple M2 Pro
Memory: 96.09 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.20.0 - /Users/oliver/.nvm/versions/node/v22.20.0/bin/node
npm: 10.9.3 - /Users/oliver/.nvm/versions/node/v22.20.0/bin/npm

Please provide a link to a minimal reproduction

No response

Describe the Bug

Providing both the -e, --env and -e, --expires options causes them both to be parsed as --env, producing the error:

✘ [ERROR] The argument "--env" expects a single value, but received multiple: ["foo","staging"].

but if I don't provide --expires I get:

✘ [ERROR] Incorrect type for the 'cacheExpiry' field on 'HttpMetadata': the provided value is not of type 'date'.

Example:

npx wrangler r2 object put testbucket/file --file=path.txt --expires="foo" --env prod

If I remove all environments from the wrangler.toml, and don't specify --env at all, just --expires, it works.

Please provide any relevant error logs

✘ [ERROR] The argument "--env" expects a single value, but received multiple: ["foo","staging"].

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething that isn't workingquick winPotentially easy/straightforward issue to tackler2Relating to R2

    Type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions