{"record":{"id":"111a2625d952860f","repo":"cloudflare/cloudflared","slug":"you-must-supply-at-least-2-arguments-first-the-ne","errorCode":null,"errorMessage":"You must supply at least 2 arguments, first the network you wish to route (in CIDR form e.g. 1.2.3.4/32) and then the tunnel ID to proxy with","messagePattern":"You must supply at least 2 arguments, first the network you wish to route \\(in CIDR form e\\.g\\. 1\\.2\\.3\\.4/32\\) and then the tunnel ID to proxy with","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/teamnet_subcommands.go","lineNumber":137,"sourceCode":"\t\treturn renderOutput(outputFormat, routes)\n\t}\n\n\tif len(routes) > 0 {\n\t\tformatAndPrintRouteList(routes)\n\t} else {\n\t\tfmt.Println(\"No routes were found for the given filter flags. You can use 'cloudflared tunnel route ip add' to add a route.\")\n\t}\n\n\treturn nil\n}\n\nfunc addRouteCommand(c *cli.Context) error {\n\tsc, err := newSubcommandContext(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.NArg() < 2 {\n\t\treturn errors.New(\"You must supply at least 2 arguments, first the network you wish to route (in CIDR form e.g. 1.2.3.4/32) and then the tunnel ID to proxy with\")\n\t}\n\n\targs := c.Args()\n\n\t_, network, err := net.ParseCIDR(args.Get(0))\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Invalid network CIDR\")\n\t}\n\tif network == nil {\n\t\treturn errors.New(\"Invalid network CIDR\")\n\t}\n\n\ttunnelRef := args.Get(1)\n\ttunnelID, err := sc.findID(tunnelRef)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"Invalid tunnel\")\n\t}\n","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/teamnet_subcommands.go#L119-L155","documentation":"cloudflared's `tunnel route ip add` command requires exactly the CIDR network and the tunnel ID/name as positional arguments. This error is returned by addRouteCommand when fewer than 2 positional arguments are provided, aborting before any API call is made.","triggerScenarios":"Running `cloudflared tunnel route ip add` with zero or one positional argument (missing the CIDR, the tunnel ID, or both).","commonSituations":"Forgetting the tunnel ID because the user assumed the currently-running tunnel is implied; shell quoting issues splitting the CIDR; habit from other CLIs where flags supply the tunnel.","solutions":["Supply both arguments: `cloudflared tunnel route ip add 10.0.0.0/8 <TUNNEL-UUID-OR-NAME>`","List tunnels with `cloudflared tunnel list` to get the tunnel ID or name","Check `cloudflared tunnel route ip add --help` for the expected argument order (network first, tunnel second)"],"exampleFix":"// before\n$ cloudflared tunnel route ip add 10.0.0.0/8\n// error: You must supply at least 2 arguments...\n// after\n$ cloudflared tunnel route ip add 10.0.0.0/8 my-tunnel","handlingStrategy":"validation","validationCode":"// shell guard before invoking\nif [ $# -lt 2 ]; then echo \"usage: cloudflared tunnel route ip add <CIDR> <TUNNEL-ID>\" >&2; exit 1; fi\ncloudflared tunnel route ip add \"$1\" \"$2\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass CIDR first, tunnel ID/name second","Resolve the tunnel ID with `cloudflared tunnel list` beforehand","Quote arguments to prevent shell splitting"],"tags":["cli","cloudflared","arguments"],"backgroundTag":"missing-cli-argument","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}