cloudflare/cloudflared · error

You must supply exactly one argument, an IP whose route…

Error message

You must supply exactly one argument, an IP whose route will be queried (e.g. 1.2.3.4 or 2001:0db8:::7334)

What it means

Argument-count guard in the `cloudflared tunnel route ip get` subcommand. It fires when the user supplies zero or more than one CLI argument; the command requires exactly one argument, the IP whose route should be queried, before it will call the Tunnelstore API.

Solutions

  1. Run with exactly one IP argument: `cloudflared tunnel route ip get 1.2.3.4`
  2. Quote IPv6 addresses: `cloudflared tunnel route ip get "2001:0db8::7334"`
  3. Remove extra arguments; the lookup needs only the IP

Example fix

// before
$ cloudflared tunnel route ip get 1.2.3.4 my-tunnel
// error: You must supply exactly one argument...
// after
$ cloudflared tunnel route ip get 1.2.3.4
Defensive patterns

Strategy: validation

Validate before calling

# exactly one IP argument, quoted
[ $# -eq 1 ] || { echo "usage: cloudflared tunnel route ip get <IP>"; exit 1; }
cloudflared tunnel route ip get "$1"

Prevention

When it happens

Trigger: Running `cloudflared tunnel route ip get` with zero arguments, or with more than one argument (extra tokens, e.g. an unquoted IPv6 with colons being split by the shell).

Common situations: Forgetting the IP entirely; passing both an IP and a tunnel ID (not needed for lookup); shell splitting an unquoted IPv6 address.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


AI-assisted analysis of cloudflare/cloudflared@2253eeeb25 (2026-09-06). Data as JSON: /api/errors/78a644343e897657. Report an issue: GitHub.

Appendix: source

Thrown at cmd/cloudflared/tunnel/teamnet_subcommands.go:229

		if err != nil {
			return err
		}
	}

	if err := sc.deleteRoute(routeId); err != nil {
		return errors.Wrap(err, "API error")
	}
	fmt.Printf("Successfully deleted route with ID %s\n", routeId)
	return nil
}

func getRouteByIPCommand(c *cli.Context) error {
	sc, err := newSubcommandContext(c)
	if err != nil {
		return err
	}
	if c.NArg() != 1 {
		return errors.New("You must supply exactly one argument, an IP whose route will be queried (e.g. 1.2.3.4 or 2001:0db8:::7334)")
	}

	ipInput := c.Args().First()
	ip := net.ParseIP(ipInput)
	if ip == nil {
		return fmt.Errorf("Invalid IP %s", ipInput)
	}

	params := cfapi.GetRouteByIpParams{
		Ip: ip,
	}

	if c.IsSet(vnetFlag.Name) {
		vnetId, err := getVnetId(sc, c.String(vnetFlag.Name))
		if err != nil {
			return err
		}
		params.VNetID = &vnetId

View on GitHub (pinned to 2253eeeb25)