txthinking/brook · error

--blockCIDR4List must be with absolute path

Error message

--blockCIDR4List must be with absolute path

What it means

Same validation as for blockDomainList applied to --blockCIDR4List: a non-empty value must be either an http(s):// URL or an absolute file path; relative paths abort startup. This list supplies IPv4 CIDRs to block.

Source

Thrown at cli/brook/main.go:270

					m[l[0]] = l[1]
				}
			}
			p := prometheus.NewPrometheus(c.String("prometheus"), c.String("prometheusPath"), m)
			p.TouchBrook()
			g.Add(&runnergroup.Runner{
				Start: func() error {
					return p.ListenAndServe()
				},
				Stop: func() error {
					return p.Shutdown()
				},
			})
		}
		if c.String("blockDomainList") != "" && !strings.HasPrefix(c.String("blockDomainList"), "http://") && !strings.HasPrefix(c.String("blockDomainList"), "https://") && !filepath.IsAbs(c.String("blockDomainList")) {
			return errors.New("--blockDomainList must be with absolute path")
		}
		if c.String("blockCIDR4List") != "" && !strings.HasPrefix(c.String("blockCIDR4List"), "http://") && !strings.HasPrefix(c.String("blockCIDR4List"), "https://") && !filepath.IsAbs(c.String("blockCIDR4List")) {
			return errors.New("--blockCIDR4List must be with absolute path")
		}
		if c.String("blockCIDR6List") != "" && !strings.HasPrefix(c.String("blockCIDR6List"), "http://") && !strings.HasPrefix(c.String("blockCIDR6List"), "https://") && !filepath.IsAbs(c.String("blockCIDR6List")) {
			return errors.New("--blockCIDR6List must be with absolute path")
		}
		if c.String("blockDomainList") != "" || c.String("blockCIDR4List") != "" || c.String("blockCIDR6List") != "" || len(c.StringSlice("blockGeoIP")) != 0 {
			p, err := block.NewBlock(c.String("blockDomainList"), c.String("blockCIDR4List"), c.String("blockCIDR6List"), c.StringSlice("blockGeoIP"), c.Int("blockListUpdateInterval"))
			if err != nil {
				return err
			}
			p.TouchBrook()
			if c.Int("blockListUpdateInterval") != 0 {
				g.Add(&runnergroup.Runner{
					Start: func() error {
						p.Update()
						return nil
					},
					Stop: func() error {
						p.Stop()

View on GitHub (pinned to 5cd13ef3b1)

Solutions

  1. Use an absolute path: --blockCIDR4List /etc/brook/cidr4.txt
  2. Use an http(s) URL for remote lists
  3. Resolve relative paths in the launch script before invoking brook

Example fix

// before
brook server -l :9999 --blockCIDR4List cidr4.txt
// after
brook server -l :9999 --blockCIDR4List /etc/brook/cidr4.txt
Defensive patterns

Strategy: validation

Validate before calling

if v := blockCIDR4List; v != "" && !strings.HasPrefix(v, "http://") && !strings.HasPrefix(v, "https://") && !filepath.IsAbs(v) {
	return fmt.Errorf("--blockCIDR4List must be URL or absolute path, got %q", v)
}

Prevention

When it happens

Trigger: --blockCIDR4List cidr4.txt or any relative path without http(s):// prefix.

Common situations: Relative paths copied from local dev setups; missing scheme on remote CIDR lists; cron/systemd units with different CWD than interactive testing.

Understand the failure class

Background: "Unknown argument", "Invalid value", and "must be one of": invalid CLI argument errors explained — this error's family across 35 libraries.

Related errors


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