crowdsecurity/crowdsec · error

expected zero or one argument for 'start_date'

Error message

expected zero or one argument for 'start_date'

What it means

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.

Source

Thrown at pkg/acquisition/modules/cloudwatch/config.go:248

			}

			lvl, err := log.ParseLevel(v[0])
			if err != nil {
				return fmt.Errorf("unknown level %s: %w", v[0], err)
			}

			s.logger.Logger.SetLevel(lvl)
		case "profile":
			if len(v) != 1 {
				return errors.New("expected zero or one value for 'profile'")
			}

			awsprof := v[0]
			s.Config.AwsProfile = &awsprof
			s.logger.Debugf("profile set to '%s'", *s.Config.AwsProfile)
		case "start_date":
			if len(v) != 1 {
				return errors.New("expected zero or one argument for 'start_date'")
			}
			// let's reuse our parser helper so that a ton of date formats are supported
			strdate, startDate := parser.GenDateParse(v[0])
			s.logger.Debugf("parsed '%s' as '%s'", v[0], strdate)
			s.Config.StartTime = &startDate
		case "end_date":
			if len(v) != 1 {
				return errors.New("expected zero or one argument for 'end_date'")
			}
			// let's reuse our parser helper so that a ton of date formats are supported
			strdate, endDate := parser.GenDateParse(v[0])
			s.logger.Debugf("parsed '%s' as '%s'", v[0], strdate)
			s.Config.EndTime = &endDate
		case "backlog":
			if len(v) != 1 {
				return errors.New("expected zero or one argument for 'backlog'")
			}
			// let's reuse our parser helper so that a ton of date formats are supported

View on GitHub (pinned to 909b515798)

Solutions

  1. Give start_date once, with a single date expression (many formats are supported via parser.GenDateParse)
  2. Use one clear window, e.g. start_date=...&end_date=..., or backlog as the alternative
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/acquisition/modules/cloudwatch/config.go:248 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/025b3cdda9018d30. Report an issue: GitHub.