{"record":{"id":"05002604f58d098e","repo":"nsqio/nsq","slug":"invalid-e2e-processing-latency-percentile-v","errorCode":null,"errorMessage":"invalid E2E processing latency percentile: %v","messagePattern":"invalid E2E processing latency percentile: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nsqd/nsqd.go","lineNumber":144,"sourceCode":"\t}\n\tif tlsConfig == nil && opts.TLSRequired != TLSNotRequired {\n\t\treturn nil, errors.New(\"cannot require TLS client connections without TLS key and cert\")\n\t}\n\tn.tlsConfig = tlsConfig\n\n\tclientTLSConfig, err := buildClientTLSConfig(opts)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to build client TLS config - %s\", err)\n\t}\n\tn.clientTLSConfig = clientTLSConfig\n\n\tif opts.AuthHTTPRequestMethod != \"post\" && opts.AuthHTTPRequestMethod != \"get\" {\n\t\treturn nil, errors.New(\"--auth-http-request-method must be post or get\")\n\t}\n\n\tfor _, v := range opts.E2EProcessingLatencyPercentiles {\n\t\tif v <= 0 || v > 1 {\n\t\t\treturn nil, fmt.Errorf(\"invalid E2E processing latency percentile: %v\", v)\n\t\t}\n\t}\n\n\tn.logf(LOG_INFO, version.String(\"nsqd\"))\n\tn.logf(LOG_INFO, \"ID: %d\", opts.ID)\n\n\tn.tcpServer = &tcpServer{nsqd: n}\n\tn.tcpListener, err = net.Listen(util.TypeOfAddr(opts.TCPAddress), opts.TCPAddress)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"listen (%s) failed - %s\", opts.TCPAddress, err)\n\t}\n\tif opts.HTTPAddress != \"\" {\n\t\tn.httpListener, err = net.Listen(util.TypeOfAddr(opts.HTTPAddress), opts.HTTPAddress)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"listen (%s) failed - %s\", opts.HTTPAddress, err)\n\t\t}\n\t}\n\tif n.tlsConfig != nil && opts.HTTPSAddress != \"\" {","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/nsqio/nsq/blob/85cf10c09c6c3c86160d6f0eb156f62d0efc1648/nsqd/nsqd.go#L126-L162","documentation":"nsqd validates every value in the E2EProcessingLatencyPercentiles option (flag --e2e-processing-latency-percentile) at startup inside New(). Each value must be a float strictly greater than 0 and at most 1.0, because it is fed to a percentile/quantile estimator (per-channel and per-topic E2E latency histograms). Passing anything outside (0, 1.0] — such as 95 for '95 percent', 0, a negative number, or 1.01 — makes New() return this error before any listener is opened.","triggerScenarios":"Running nsqd with --e2e-processing-latency-percentile=95 (or 95.0, 0, -0.5, 1.5), or comma-separated lists like '1.0,0.99,95'. Also triggered programmatically when a caller builds nsqd.Options directly and sets E2EProcessingLatencyPercentiles to a raw percentage instead of a fraction.","commonSituations":"The classic mistake is giving the percentile as a whole number (95 instead of 0.95) because the flag name suggests a percentage. The help text explicitly says 'as float (0, 1.0])' but users still pass 100.0 for '100th percentile'. Misconfigured cfg files (key e2e_processing_latency_percentiles) or environment-derived values hit the same path.","solutions":["Change the flag value to a fraction in (0, 1.0]: --e2e-processing-latency-percentile=0.95 (use 1.0 for max, never 0).","If a comma-separated list was used, check every element; one bad element aborts startup: '1.0,0.99,0.95'.","If setting nsqd.Options in Go code, normalize before New(): divide values >1 by 100 or reject them with your own message.","Re-run nsqd; validation happens before listeners bind, so no port state is affected."],"exampleFix":"# before\nnsqd --e2e-processing-latency-percentile=95\n\n# after\nnsqd --e2e-processing-latency-percentile=0.95","handlingStrategy":"validation","validationCode":"// before calling nsqd.New(opts):\nfor _, p := range opts.E2EProcessingLatencyPercentiles {\n    if p <= 0 || p > 1 {\n        return fmt.Errorf(\"percentile %v must be in (0, 1.0] (use 0.95, not 95)\", p)\n    }\n}","typeGuard":"func isValidPercentile(p float64) bool { return p > 0 && p <= 1.0 }","tryCatchPattern":null,"preventionTips":["Pass fractions, never whole percentages: 0.95 not 95.","When accepting percentiles from users/config, normalize values >1 by dividing by 100 before constructing nsqd.Options.","Validate option structs in a preflight check before New() so the error message is yours."],"tags":["nsqd","configuration","validation","startup","percentile"],"backgroundTag":null,"analyzedSha":"85cf10c09c6c3c86160d6f0eb156f62d0efc1648","analyzedAt":"2026-08-16T00:53:05.009Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}