{"record":{"id":"5179bfe25c280b54","repo":"txthinking/brook","slug":"you-forgot-the-prometheuspath","errorCode":null,"errorMessage":"You forgot the --prometheusPath","messagePattern":"You forgot the --prometheusPath","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/brook/main.go","lineNumber":242,"sourceCode":"\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tp.TouchBrook()\n\t\t}\n\t\tif c.String(\"dialWithNIC\") != \"\" {\n\t\t\tp := dialwithnic.NewDialWithNIC(c.String(\"dialWithNIC\"))\n\t\t\tp.TouchBrook()\n\t\t}\n\t\tif c.String(\"dialWithSocks5\") != \"\" {\n\t\t\tp, err := socks5dial.NewSocks5Dial(c.String(\"dialWithSocks5\"), c.String(\"dialWithSocks5Username\"), c.String(\"dialWithSocks5Password\"), c.Int(\"dialWithSocks5TCPTimeout\"), c.Int(\"dialWithSocks5UDPTimeout\"))\n\t\t\tif err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t\tp.TouchBrook()\n\t\t}\n\t\tif c.String(\"prometheus\") != \"\" {\n\t\t\tif c.String(\"prometheusPath\") == \"\" {\n\t\t\t\treturn errors.New(\"You forgot the --prometheusPath\")\n\t\t\t}\n\t\t\tvar m map[string]string\n\t\t\tif len(c.StringSlice(\"tag\")) > 0 {\n\t\t\t\tm = make(map[string]string)\n\t\t\t\tfor _, v := range c.StringSlice(\"tag\") {\n\t\t\t\t\tl := strings.Split(v, \":\")\n\t\t\t\t\tif len(l) != 2 {\n\t\t\t\t\t\treturn errors.New(\"Invalid tag \" + v)\n\t\t\t\t\t}\n\t\t\t\t\tm[l[0]] = l[1]\n\t\t\t\t}\n\t\t\t}\n\t\t\tp := prometheus.NewPrometheus(c.String(\"prometheus\"), c.String(\"prometheusPath\"), m)\n\t\t\tp.TouchBrook()\n\t\t\tg.Add(&runnergroup.Runner{\n\t\t\t\tStart: func() error {\n\t\t\t\t\treturn p.ListenAndServe()\n\t\t\t\t},","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/txthinking/brook/blob/5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8/cli/brook/main.go#L224-L260","documentation":"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.","triggerScenarios":"Running any subcommand with --prometheus but without --prometheusPath, e.g. --prometheus 127.0.0.1:18080.","commonSituations":"Copying prometheus flags from docs that mention only --prometheus; configs where the path flag was dropped during refactoring of service definitions.","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"],"exampleFix":"// before\nbrook server -l :9999 --prometheus 127.0.0.1:18080\n// after\nbrook server -l :9999 --prometheus 127.0.0.1:18080 --prometheusPath /metrics","handlingStrategy":"validation","validationCode":"if prometheusAddr != \"\" && prometheusPath == \"\" {\n\treturn errors.New(\"--prometheus requires --prometheusPath\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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"],"tags":["cli","prometheus","missing-flag"],"backgroundTag":"missing-required-flag","analyzedSha":"5cd13ef3b1fb574e88ebf2c1b5d95f2ebe1342c8","analyzedAt":"2026-09-06T04:35:00.432Z","contentChangedAt":"2026-09-06T04:35:00.432Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}