txthinking/brook · error

--blockDomainList must be with absolute path

Error message

--blockDomainList must be with absolute path

What it means

--blockDomainList accepts a local file or an http(s) URL. If the value is non-empty, not an http(s) URL, and not an absolute filesystem path, the CLI rejects it at startup. This ensures block list sources are unambiguously fetchable/readable.

Source

Thrown at cli/brook/main.go:267

					if len(l) != 2 {
						return errors.New("Invalid tag " + v)
					}
					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

View on GitHub (pinned to 5cd13ef3b1)

Solutions

  1. Use an absolute path: --blockDomainList /etc/brook/blockdomains.txt
  2. Use a full URL: --blockDomainList https://example.com/blockdomains.txt
  3. Resolve the path in your wrapper: --blockDomainList "$PWD/lists/domains.txt"

Example fix

// before
brook server -l :9999 --blockDomainList lists/domains.txt
// after
brook server -l :9999 --blockDomainList /etc/brook/lists/domains.txt
Defensive patterns

Strategy: validation

Validate before calling

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

Prevention

When it happens

Trigger: Running a subcommand with --blockDomainList set to a relative path like lists/domains.txt, or any value that lacks both an http(s):// prefix and an absolute path.

Common situations: Relative paths in example configs; forgetting the http(s):// scheme for remote lists; working-directory assumptions in scripts.

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/34cc5ba54143581e. Report an issue: GitHub.