txthinking/brook · error

${ip} unknown

Error message

${ip} unknown

What it means

Lookup failure in the ipcountry subcommand: the --ip value parsed as a valid IP, but iploc.Country returned an empty string, meaning the IP is not present in the bundled IP-to-country database (common for private/reserved ranges or IPs newer than the data). Not a syntax error like the preceding 'is not IP' check.

Source

Thrown at cli/brook/main.go:2735

					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",
				},
				&cli.BoolFlag{
					Name:  "example",
					Usage: "Show a minimal example of usage",

View on GitHub (pinned to 5cd13ef3b1)

Solutions

  1. Confirm the IP is a public, assigned address (private/reserved ranges have no country)
  2. Try a different public IP to verify the tool works
  3. Update brook/iploc data if the IP was recently allocated
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at cli/brook/main.go:2735 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/953bd46224543fa8. Report an issue: GitHub.