{"record":{"id":"0e2e76d1a70e099d","repo":"crowdsecurity/crowdsec","slug":"expected-zero-or-one-argument-for-backlog","errorCode":null,"errorMessage":"expected zero or one argument for 'backlog'","messagePattern":"expected zero or one argument for 'backlog'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/cloudwatch/config.go","lineNumber":264,"sourceCode":"\t\tcase \"start_date\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one argument for 'start_date'\")\n\t\t\t}\n\t\t\t// let's reuse our parser helper so that a ton of date formats are supported\n\t\t\tstrdate, startDate := parser.GenDateParse(v[0])\n\t\t\ts.logger.Debugf(\"parsed '%s' as '%s'\", v[0], strdate)\n\t\t\ts.Config.StartTime = &startDate\n\t\tcase \"end_date\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one argument for 'end_date'\")\n\t\t\t}\n\t\t\t// let's reuse our parser helper so that a ton of date formats are supported\n\t\t\tstrdate, endDate := parser.GenDateParse(v[0])\n\t\t\ts.logger.Debugf(\"parsed '%s' as '%s'\", v[0], strdate)\n\t\t\ts.Config.EndTime = &endDate\n\t\tcase \"backlog\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one argument for 'backlog'\")\n\t\t\t}\n\t\t\t// let's reuse our parser helper so that a ton of date formats are supported\n\t\t\tduration, err := time.ParseDuration(v[0])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to parse '%s' as duration: %w\", v[0], err)\n\t\t\t}\n\n\t\t\ts.logger.Debugf(\"parsed '%s' as '%s'\", v[0], duration)\n\t\t\tstart := time.Now().UTC().Add(-duration)\n\t\t\ts.Config.StartTime = &start\n\t\t\tend := time.Now().UTC()\n\t\t\ts.Config.EndTime = &end\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unexpected argument %s\", k)\n\t\t}\n\t}\n\n\ts.logger.Tracef(\"host=%s\", s.Config.GroupName)","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/cloudwatch/config.go#L246-L282","documentation":"DSN validation in ConfigureByDSN for the cloudwatch source: the backlog query parameter (how far back to read) was repeated. The guard requires exactly one value; a single duration is converted into StartTime/EndTime bounds.","triggerScenarios":"Thrown at pkg/acquisition/modules/cloudwatch/config.go:264 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass backlog once, e.g. backlog=1h","Prefer backlog over explicit start_date/end_date if you just want 'last N duration' semantics"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}