crowdsecurity/crowdsec · error

expected zero or one argument for 'end_date'

Error message

expected zero or one argument for 'end_date'

What it means

Validation guard in ConfigureByDSN of the cloudwatch source: the 'start_date'/'end_date' DSN parameter accepts exactly one value; the query string supplied more than one value for 'end_date' (e.g. end_date=a&end_date=b), so the DSN is rejected.

Source

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

		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
			duration, err := time.ParseDuration(v[0])
			if err != nil {
				return fmt.Errorf("unable to parse '%s' as duration: %w", v[0], err)
			}

			s.logger.Debugf("parsed '%s' as '%s'", v[0], duration)
			start := time.Now().UTC().Add(-duration)
			s.Config.StartTime = &start

View on GitHub (pinned to 909b515798)

Solutions

  1. Provide end_date exactly once in the DSN
  2. Pair it with a single start_date to define the retrieval window
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/acquisition/modules/cloudwatch/config.go:256 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/1b29432fd658b737. Report an issue: GitHub.