{"record":{"id":"4e7bb9bf93fe403e","repo":"txthinking/brook","slug":"ip-is-not-ip","errorCode":null,"errorMessage":"${ip} is not IP","messagePattern":"(.+?) is not IP","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/brook/main.go","lineNumber":2731,"sourceCode":"\t\t\t},\n\t\t\tFlags: []cli.Flag{\n\t\t\t\t&cli.StringFlag{\n\t\t\t\t\tName:  \"ip\",\n\t\t\t\t\tUsage: \"1.1.1.1\",\n\t\t\t\t},\n\t\t\t\t&cli.BoolFlag{\n\t\t\t\t\tName:  \"example\",\n\t\t\t\t\tUsage: \"Show a minimal example of usage\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tAction: func(c *cli.Context) error {\n\t\t\t\tif c.Bool(\"example\") {\n\t\t\t\t\tfmt.Println(\"brook ipcountry --ip 1.2.3.4\")\n\t\t\t\t\treturn nil\n\t\t\t\t}\n\t\t\t\tip := net.ParseIP(c.String(\"ip\"))\n\t\t\t\tif ip == nil {\n\t\t\t\t\treturn errors.New(c.String(\"ip\") + \" is not IP\")\n\t\t\t\t}\n\t\t\t\ts := iploc.Country(ip)\n\t\t\t\tif s == \"\" {\n\t\t\t\t\treturn errors.New(c.String(\"ip\") + \" unknown\")\n\t\t\t\t}\n\t\t\t\tfmt.Println(s)\n\t\t\t\treturn nil\n\t\t\t},\n\t\t},\n\t\t&cli.Command{\n\t\t\tName:  \"completion\",\n\t\t\tUsage: \"Generate shell completions\",\n\t\t\tFlags: []cli.Flag{\n\t\t\t\t&cli.StringFlag{\n\t\t\t\t\tName:    \"file\",\n\t\t\t\t\tAliases: []string{\"f\"},\n\t\t\t\t\tUsage:   \"Write to file\",\n\t\t\t\t\tValue:   \"brook_autocomplete\",","sourceCodeStart":2713,"sourceCodeEnd":2749,"githubUrl":"https://github.com/txthinking/brook/blob/5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8/cli/brook/main.go#L2713-L2749","documentation":"Validation failure in the ipcountry subcommand: net.ParseIP returned nil for the --ip flag value, so the argument is not a syntactically valid IPv4/IPv6 address and country lookup cannot proceed. The input at fault is whatever string the user passed to --ip.","triggerScenarios":"Thrown at cli/brook/main.go:2731 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a valid IP, e.g. brook ipcountry --ip 1.2.3.4","Check for typos, stray ports, or hostnames -- only raw IPs are accepted"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8","analyzedAt":"2026-09-06T04:35:00.432Z","contentChangedAt":"2026-09-06T04:35:00.432Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}