Skip to content

🐛 Setting grace period to anything makes cloudflared exit immediately #1606

@FibreTTP

Description

@FibreTTP

Describe the bug
I haven't tested this with a local configuration.

Setting the grace period as defined in the Tunnel run parameters section in the docs using an environment variable makes cloudflared exit immediately with no output and code 0.

Setting it with cloudflared tunnel --grace-period 10 run prints Incorrect Usage. invalid value "10" for flag -grace-period: parse error, exiting with code 0.

While I haven't tested with a local configuration, and even though the documentation suggests it only works with one (usage places <UUID or NAME> after the parameter in the example), it doesn't explicitly state so like it does with origincert, for example. (so I assume this isn't a documentation error, and grace period is supposed to be supported with a remote managed configuration. I don't see why not?)

To Reproduce
Environment variable:

  1. Run:
TUNNEL_GRACE_PERIOD=10 TUNNEL_TOKEN=TOKEN /opt/cloudflared/cloudflared-linux-amd64 tunnel run
  1. It exits immediately. No error printed.

In fact, if you omit the token and just run:

TUNNEL_GRACE_PERIOD=10 /opt/cloudflared/cloudflared-linux-amd64 tunnel run

The help message "cloudflared tunnel run" requires the ID or name of the tunnel to run as the last command line argument or in the configuration file. doesn't appear at all. You can actually just run the path to the binary without any parameters, and the simple presence of that environment variable causes cloudflared to just exit without doing anything.

Command line parameter:

  1. Run:
/opt/cloudflared/cloudflared-linux-amd64 tunnel --grace-period 10 run
  1. Usage message prints with Incorrect Usage. invalid value "10" for flag -grace-period: parse error.

Expected behavior
If the issue is because it is a remote managed configuration, cloudflared would at least state that a grace period isn't supported with remote configurations. If not, it should just work.

Environment and versions

  • OS: Unprivileged Debian 13 LXC on Proxmox 9
  • Architecture: AMD64
  • Version: 2026.2.0, running from the binary available in Releases.

Logs and errors
See above.

Additional context
Tested both as root, and as a dedicated cloudflared user and group, both from a shell, and from a systemd service. The systemd service exits with the message: cloudflared.service: Failed with result 'protocol'.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Priority: NormalMinor issue impacting one or more usersType: BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions