{"record":{"id":"025b3cdda9018d30","repo":"crowdsecurity/crowdsec","slug":"expected-zero-or-one-argument-for-start-date","errorCode":null,"errorMessage":"expected zero or one argument for 'start_date'","messagePattern":"expected zero or one argument for 'start_date'","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/cloudwatch/config.go","lineNumber":248,"sourceCode":"\t\t\t}\n\n\t\t\tlvl, err := log.ParseLevel(v[0])\n\t\t\tif err != nil {\n\t\t\t\treturn fmt.Errorf(\"unknown level %s: %w\", v[0], err)\n\t\t\t}\n\n\t\t\ts.logger.Logger.SetLevel(lvl)\n\t\tcase \"profile\":\n\t\t\tif len(v) != 1 {\n\t\t\t\treturn errors.New(\"expected zero or one value for 'profile'\")\n\t\t\t}\n\n\t\t\tawsprof := v[0]\n\t\t\ts.Config.AwsProfile = &awsprof\n\t\t\ts.logger.Debugf(\"profile set to '%s'\", *s.Config.AwsProfile)\n\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","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/cloudwatch/config.go#L230-L266","documentation":"DSN validation in ConfigureByDSN for the cloudwatch source: the start_date query parameter was repeated. The guard requires exactly one value because a single StartTime is stored on the config; conflicting dates cannot be reconciled.","triggerScenarios":"Thrown at pkg/acquisition/modules/cloudwatch/config.go:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Give start_date once, with a single date expression (many formats are supported via parser.GenDateParse)","Use one clear window, e.g. start_date=...&end_date=..., or backlog as the alternative"],"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"}