cloudflare/cloudflared · error
errAddRoute
errAddRoute
Error message
You must supply exactly one argument, the ID or CIDR of the route you want to delete
What it means
errAddRoute is the shared validation error for the teamnet route commands: `cloudflared tunnel route ip delete` (and add) requires exactly one positional argument — a route ID or CIDR. It is returned when NArg != 1 or when the argument is not a valid IP/CIDR (net.ParseCIDR fails for delete).
Source
Thrown at cmd/cloudflared/tunnel/teamnet_subcommands.go:25
"text/tabwriter"
"github.com/google/uuid"
"github.com/pkg/errors"
"github.com/urfave/cli/v2"
"github.com/cloudflare/cloudflared/cfapi"
"github.com/cloudflare/cloudflared/cmd/cloudflared/cliutil"
"github.com/cloudflare/cloudflared/cmd/cloudflared/updater"
)
var (
vnetFlag = &cli.StringFlag{
Name: "vnet",
Aliases: []string{"vn"},
Usage: "The ID or name of the virtual network to which the route is associated to.",
}
errAddRoute = errors.New("You must supply exactly one argument, the ID or CIDR of the route you want to delete")
)
func buildRouteIPSubcommand() *cli.Command {
return &cli.Command{
Name: "ip",
Usage: "Configure and query Cloudflare WARP routing to private IP networks made available through Cloudflare Tunnels.",
UsageText: "cloudflared tunnel [--config FILEPATH] route COMMAND [arguments...]",
Description: `cloudflared can provision routes for any IP space in your corporate network. Users enrolled in
your Cloudflare for Teams organization can reach those IPs through the Cloudflare WARP
client. You can then configure L7/L4 filtering on https://one.dash.cloudflare.com to
determine who can reach certain routes.
By default IP routes all exist within a single virtual network. If you use the same IP
space(s) in different physical private networks, all meant to be reachable via IP routes,
then you have to manage the ambiguous IP routes by associating them to virtual networks.
See "cloudflared tunnel vnet --help" for more information.`,
Subcommands: []*cli.Command{
{
Name: "add",View on GitHub (pinned to 2253eeeb25)
Solutions
- Supply exactly one argument: `cloudflared tunnel route ip delete 10.0.0.0/8`.
- Validate CIDR notation (use `ipcalc` or similar) before running in scripts.
- Check `cloudflared tunnel route ip show` first to get the exact ID/CIDR to delete.
- Quote the CIDR so the shell does not split or glob it.
Example fix
// before cloudflared tunnel route ip delete // after cloudflared tunnel route ip delete 10.0.0.0/8
Defensive patterns
Strategy: validation
Validate before calling
if [ "$#" -ne 1 ]; then echo "usage: cloudflared tunnel route ip delete <cidr|id>" >&2; exit 1 fi if ! python3 -c "import ipaddress,sys; ipaddress.ip_network(sys.argv[1])" "$1" 2>/dev/null; then echo "$1 is not a valid IP or CIDR" >&2; exit 1 fi
Prevention
- Assert exactly one positional argument in wrapper scripts.
- Validate CIDR/IP syntax before calling route commands.
- Quote arguments to prevent shell splitting/globbing.
When it happens
Trigger: Running `cloudflared tunnel route ip delete` with zero or multiple arguments; passing a value that is neither a valid IP nor CIDR (e.g. `10.0.0.1/33`, a hostname, or a malformed route UUID).
Common situations: Forgetting the argument in health-check or cleanup scripts; typos in CIDR notation; passing a hostname instead of a CIDR; pasting extra tokens so NArg > 1.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Invalid network CIDR
- Invalid CIDR supplied for %s
- not a valid host
- no input provided
- failed to parse Host
AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06).
Data as JSON: /api/errors/397766cae5cc520c.
Report an issue: GitHub.