txthinking/brook · error

${ip} is not IP

Error message

${ip} is not IP

What it means

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.

Source

Thrown at cli/brook/main.go:2731

			},
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:  "ip",
					Usage: "1.1.1.1",
				},
				&cli.BoolFlag{
					Name:  "example",
					Usage: "Show a minimal example of usage",
				},
			},
			Action: func(c *cli.Context) error {
				if c.Bool("example") {
					fmt.Println("brook ipcountry --ip 1.2.3.4")
					return nil
				}
				ip := net.ParseIP(c.String("ip"))
				if ip == nil {
					return errors.New(c.String("ip") + " is not IP")
				}
				s := iploc.Country(ip)
				if s == "" {
					return errors.New(c.String("ip") + " unknown")
				}
				fmt.Println(s)
				return nil
			},
		},
		&cli.Command{
			Name:  "completion",
			Usage: "Generate shell completions",
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:    "file",
					Aliases: []string{"f"},
					Usage:   "Write to file",
					Value:   "brook_autocomplete",

View on GitHub (pinned to 5cd13ef3b1)

Solutions

  1. Pass a valid IP, e.g. brook ipcountry --ip 1.2.3.4
  2. Check for typos, stray ports, or hostnames -- only raw IPs are accepted
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/brook/main.go:2731 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of txthinking/brook@5cd13ef3b1 (2026-09-06). Data as JSON: /api/errors/4e7bb9bf93fe403e. Report an issue: GitHub.