{"record":{"id":"6d1b0d5ca3d81a3c","repo":"crowdsecurity/crowdsec","slug":"invalid-limit-in-dsn-w-6d1b0d","errorCode":null,"errorMessage":"invalid limit in dsn: %w","messagePattern":"invalid limit in dsn: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/victorialogs/config.go","lineNumber":179,"sourceCode":"\t\t\treturn fmt.Errorf(\"invalid since in dsn: %w\", err)\n\t\t}\n\t}\n\n\tif maxFailureDuration := params.Get(\"max_failure_duration\"); maxFailureDuration != \"\" {\n\t\tduration, err := time.ParseDuration(maxFailureDuration)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid max_failure_duration in dsn: %w\", err)\n\t\t}\n\n\t\ts.Config.MaxFailureDuration = duration\n\t} else {\n\t\ts.Config.MaxFailureDuration = 5 * time.Second // for OneShot mode it doesn't make sense to have longer duration\n\t}\n\n\tif limit := params.Get(\"limit\"); limit != \"\" {\n\t\tlimit, err := strconv.Atoi(limit)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid limit in dsn: %w\", err)\n\t\t}\n\n\t\ts.Config.Limit = limit\n\t}\n\n\tif logLevel := params.Get(\"log_level\"); logLevel != \"\" {\n\t\tlevel, err := log.ParseLevel(logLevel)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"invalid log_level in dsn: %w\", err)\n\t\t}\n\n\t\ts.Config.LogLevel = level\n\t\ts.logger.Logger.SetLevel(level)\n\t}\n\n\ts.Config.URL = fmt.Sprintf(\"%s://%s\", scheme, u.Host)\n\tif u.User != nil {\n\t\ts.Config.Auth.Username = u.User.Username()","sourceCodeStart":161,"sourceCodeEnd":197,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/victorialogs/config.go#L161-L197","documentation":"ConfigureByDSN parses the optional `limit` DSN parameter with strconv.Atoi, which requires a plain integer. Any non-numeric value causes the error to be wrapped with \"invalid limit in dsn\" and configuration to fail.","triggerScenarios":"Setting `limit=` in the DSN to a value Atoi cannot parse, e.g. `limit=1000 events`, `limit=1_000`, or an empty-but-present value is skipped, but `limit=0x10` fails.","commonSituations":"Copy-pasting formatted numbers with separators or suffixes (\"10k\"), or quoting/spacing mistakes in acquis.yaml; the limit caps the number of log entries fetched per query.","solutions":["Set `limit` to a plain decimal integer, e.g. `limit=10000`","Remove spaces, separators and unit suffixes (no commas, underscores or \"k\")","Omit the parameter to use the default limit","Check the wrapped strconv error for the offending input"],"exampleFix":"// before\nurl: victorialogs+http://127.0.0.1:8428?limit=10,000\n// after\nurl: victorialogs+http://127.0.0.1:8428?limit=10000","handlingStrategy":"validation","validationCode":"const limit = p.searchParams.get(\"limit\")\nif (limit && !/^\\d+$/.test(limit)) {\n  throw new Error(`invalid limit: ${limit}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use plain decimal integers without separators or suffixes","Quote DSN strings in YAML to avoid shell/YAML mangling of values","Spot-check the parsed config with cscli after edits"],"tags":["config","integer-parsing","victorialogs"],"backgroundTag":"invalid-config-value","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}