crowdsecurity/crowdsec · error

expected zero or one value for 'profile'

Error message

expected zero or one value for 'profile'

What it means

DSN validation in ConfigureByDSN for the cloudwatch source: the profile query parameter (AWS shared-config profile) was repeated in the DSN. The guard requires exactly one value; multiple profiles are ambiguous because only one AwsProfile can be selected for the session.

Source

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

		return fmt.Errorf("while parsing %s: %w", dsn, err)
	}

	for k, v := range u {
		switch k {
		case "log_level":
			if len(v) != 1 {
				return errors.New("expected zero or one value for 'log_level'")
			}

			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

View on GitHub (pinned to 909b515798)

Solutions

  1. Pass profile=... exactly once in the DSN
  2. If you need a different AWS profile, change the single profile parameter rather than adding another
Defensive patterns

Strategy: validation

When it happens

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