{"record":{"id":"ea99adfbd289d3c7","repo":"cloudflare/cloudflared","slug":"invalid-ip-s","errorCode":null,"errorMessage":"Invalid IP %s","messagePattern":"Invalid IP (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/cloudflared/tunnel/teamnet_subcommands.go","lineNumber":235,"sourceCode":"\t\treturn errors.Wrap(err, \"API error\")\n\t}\n\tfmt.Printf(\"Successfully deleted route with ID %s\\n\", routeId)\n\treturn nil\n}\n\nfunc getRouteByIPCommand(c *cli.Context) error {\n\tsc, err := newSubcommandContext(c)\n\tif err != nil {\n\t\treturn err\n\t}\n\tif c.NArg() != 1 {\n\t\treturn 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)\")\n\t}\n\n\tipInput := c.Args().First()\n\tip := net.ParseIP(ipInput)\n\tif ip == nil {\n\t\treturn fmt.Errorf(\"Invalid IP %s\", ipInput)\n\t}\n\n\tparams := cfapi.GetRouteByIpParams{\n\t\tIp: ip,\n\t}\n\n\tif c.IsSet(vnetFlag.Name) {\n\t\tvnetId, err := getVnetId(sc, c.String(vnetFlag.Name))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tparams.VNetID = &vnetId\n\t}\n\n\troute, err := sc.getRouteByIP(params)\n\tif err != nil {\n\t\treturn errors.Wrap(err, \"API error\")\n\t}","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/cloudflare/cloudflared/blob/2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f/cmd/cloudflared/tunnel/teamnet_subcommands.go#L217-L253","documentation":"getRouteByIPCommand queries the Cloudflare API for the route associated with a given IP. The command takes exactly one argument that must parse as an IP address via net.ParseIP; when parsing fails (nil result), this error reports the invalid input.","triggerScenarios":"Running `cloudflared tunnel route ip get <arg>` where <arg> is not a valid IPv4/IPv6 literal — e.g. a hostname, a CIDR with unusual formatting, empty argument shaped like an IP, or a typo such as 1.2.3.256 or 2001:0db8:::7334-style typos.","commonSituations":"Passing a DNS name instead of an IP; passing a subnet like 10.0.0.0/8 (ParseIP rejects the /8 suffix); copy-paste artifacts; malformed IPv6 with too many '::' groups.","solutions":["Supply a valid IP literal, e.g. `cloudflared tunnel route ip get 10.0.0.1`.","If you have a CIDR to look up, strip or adjust the prefix to a concrete IP the route was created with.","Resolve hostnames to IPs first (e.g. `dig +short host`) before passing them."],"exampleFix":"// before\ncloudflared tunnel route ip get example.com\n// after\ncloudflared tunnel route ip get 10.0.0.1","handlingStrategy":"validation","validationCode":"ip := net.ParseIP(os.Args[len(os.Args)-1])\nif ip == nil {\n    return fmt.Errorf(\"%q is not a valid IP literal\", os.Args[len(os.Args)-1])\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass raw IPv4/IPv6 literals, not hostnames or CIDR suffixes.","Resolve hostnames with dig/nsbt beforehand.","Sanitize copy-pasted IPs for typos and stray characters."],"tags":["cli","validation","ip","network"],"backgroundTag":"invalid-cli-argument","analyzedSha":"2253eeeb25a44a713a4b60b8ba1e1b3f377d1a0f","analyzedAt":"2026-09-06T04:14:33.757Z","contentChangedAt":"2026-09-06T04:14:33.757Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}