crowdsecurity/crowdsec · error

bucket_name and sqs_name are mutually exclusive

Error message

bucket_name and sqs_name are mutually exclusive

What it means

The s3 source can poll either an S3 bucket directly (list mode) or consume SQS notifications, but a single source must target exactly one. UnmarshalConfig rejects configs specifying both bucket_name and sqs_name.

Source

Thrown at pkg/acquisition/modules/s3/config.go:135

	if s.Config.PollingMethod == "" {
		s.Config.PollingMethod = PollMethodList
	}

	if s.Config.PollingInterval == 0 {
		s.Config.PollingInterval = 60
	}

	if s.Config.MaxBufferSize == 0 {
		s.Config.MaxBufferSize = bufio.MaxScanTokenSize
	}

	if s.Config.PollingMethod != PollMethodList && s.Config.PollingMethod != PollMethodSQS {
		return fmt.Errorf("invalid polling method %s", s.Config.PollingMethod)
	}

	if s.Config.BucketName != "" && s.Config.SQSName != "" {
		return errors.New("bucket_name and sqs_name are mutually exclusive")
	}

	if s.Config.PollingMethod == PollMethodSQS && s.Config.SQSName == "" {
		return errors.New("sqs_name is required when using sqs polling method")
	}

	if s.Config.BucketName == "" && s.Config.PollingMethod == PollMethodList {
		return errors.New("bucket_name is required")
	}

	if s.Config.SQSFormat != "" && s.Config.SQSFormat != SQSFormatEventBridge && s.Config.SQSFormat != SQSFormatS3Notification && s.Config.SQSFormat != SQSFormatSNS {
		return fmt.Errorf("invalid sqs_format %s, must be empty, %s, %s or %s", s.Config.SQSFormat, SQSFormatEventBridge, SQSFormatS3Notification, SQSFormatSNS)
	}

	return nil
}

func (s *Source) Configure(ctx context.Context, yamlConfig []byte, logger *log.Entry, _ metrics.AcquisitionMetricsLevel) error {

View on GitHub (pinned to 909b515798)

Solutions

  1. Keep only sqs_name if you consume S3 events via SQS
  2. Keep only bucket_name if you use list polling
  3. Split into two separate acquisition files if you need both

Example fix

// before
bucket_name: my-bucket
sqs_name: my-queue
// after
bucket_name: my-bucket
Defensive patterns

Strategy: validation

Validate before calling

if cfg.BucketName != "" && cfg.SQSName != "" {
    return errors.New("set either bucket_name or sqs_name, not both")
}

Prevention

When it happens

Trigger: An s3.yaml acquisition config containing non-empty values for both `bucket_name` and `sqs_name`, after polling-method validation in UnmarshalConfig.

Common situations: Merging two example configs, adding an sqs_name to an existing bucket config without removing bucket_name, or templating that filled both fields.

Related errors


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