{"record":{"id":"4acdec9081d27cfc","repo":"crowdsecurity/crowdsec","slug":"invalid-limit-in-dsn-w","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/loki/config.go","lineNumber":190,"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\tl.Config.MaxFailureDuration = duration\n\t} else {\n\t\tl.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\tl.Config.Limit = limit\n\t} else {\n\t\tl.Config.Limit = 5000 // max limit allowed by loki\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\tl.Config.LogLevel = level\n\t\tl.logger.Logger.SetLevel(level)\n\t}\n\n\tif noReadyCheck := params.Get(\"no_ready_check\"); noReadyCheck != \"\" {","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/loki/config.go#L172-L208","documentation":"ConfigureByDSN parses the Loki acquisition DSN's query parameters. The 'limit' parameter must be a valid integer; if strconv.Atoi fails, this error wraps the parse failure and aborts configuration. It exists to fail fast on a malformed DSN rather than silently defaulting.","triggerScenarios":"A DSN such as loki://host:3100/?limit=abc or limit=1_000 is passed to the Loki acquire configuration.","commonSituations":"Typos or pasted URLs where 'limit' contains units, commas, or quotes; template variables left unexpanded in acquis.yaml.","solutions":["Set 'limit' to a plain integer in the DSN, e.g. loki://host:3100/?limit=5000","Remove the 'limit' parameter entirely to use the default of 5000 (Loki's max)","URL-encode the parameter if special characters are intended"],"exampleFix":"// before\nloki://localhost:3100/?limit=10,000\n// after\nloki://localhost:3100/?limit=10000","handlingStrategy":"validation","validationCode":"limitRaw := params.Get(\"limit\")\nif limitRaw != \"\" {\n    n, err := strconv.Atoi(limitRaw)\n    if err != nil || n <= 0 {\n        return fmt.Errorf(\"limit must be a positive integer, got %q\", limitRaw)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep numeric DSN params unit-free and unquoted","Validate the whole DSN with cscli before deploying acquis.yaml"],"tags":["config","loki","parsing"],"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"}