txthinking/brook · error
You forgot the --prometheusPath
Error message
You forgot the --prometheusPath
What it means
When --prometheus is enabled, brook exposes metrics on an HTTP path that must be given via --prometheusPath. If --prometheus is set but --prometheusPath is empty, the CLI refuses to start. It prevents silently mounting metrics at an empty/unusable path.
Source
Thrown at cli/brook/main.go:242
if err != nil {
return err
}
p.TouchBrook()
}
if c.String("dialWithNIC") != "" {
p := dialwithnic.NewDialWithNIC(c.String("dialWithNIC"))
p.TouchBrook()
}
if c.String("dialWithSocks5") != "" {
p, err := socks5dial.NewSocks5Dial(c.String("dialWithSocks5"), c.String("dialWithSocks5Username"), c.String("dialWithSocks5Password"), c.Int("dialWithSocks5TCPTimeout"), c.Int("dialWithSocks5UDPTimeout"))
if err != nil {
return err
}
p.TouchBrook()
}
if c.String("prometheus") != "" {
if c.String("prometheusPath") == "" {
return errors.New("You forgot the --prometheusPath")
}
var m map[string]string
if len(c.StringSlice("tag")) > 0 {
m = make(map[string]string)
for _, v := range c.StringSlice("tag") {
l := strings.Split(v, ":")
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()
},View on GitHub (pinned to 5cd13ef3b1)
Solutions
- Add --prometheusPath /metrics (or your desired path) alongside --prometheus
- Remove --prometheus if metrics are not needed
- Set both flags together in your service template
Example fix
// before brook server -l :9999 --prometheus 127.0.0.1:18080 // after brook server -l :9999 --prometheus 127.0.0.1:18080 --prometheusPath /metrics
Defensive patterns
Strategy: validation
Validate before calling
if prometheusAddr != "" && prometheusPath == "" {
return errors.New("--prometheus requires --prometheusPath")
} Prevention
- Always pair --prometheus with --prometheusPath /metrics
- Set both flags in the same service definition
- Add a startup smoke test that runs the CLI with your flag set
When it happens
Trigger: Running any subcommand with --prometheus but without --prometheusPath, e.g. --prometheus 127.0.0.1:18080.
Common situations: Copying prometheus flags from docs that mention only --prometheus; configs where the path flag was dropped during refactoring of service definitions.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- --pid must be with absolute path
- --log must be with absolute path
- Invalid tag
- --blockDomainList must be with absolute path
- --blockCIDR4List must be with absolute path
AI-assisted analysis of txthinking/brook@5cd13ef3b1 (2026-09-06).
Data as JSON: /api/errors/5179bfe25c280b54.
Report an issue: GitHub.