crowdsecurity/crowdsec · error

bucket_name is required

Error message

bucket_name is required

What it means

Validation in the S3 datasource's UnmarshalConfig: bucket_name is empty while the polling method is list. In list mode the module must enumerate objects directly from a bucket, so the bucket name is the identifying anchor; in sqs mode the bucket is derived from events and this check does not apply.

Source

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

	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 {
	err := s.UnmarshalConfig(yamlConfig)
	if err != nil {
		return err
	}

	if s.Config.SQSName != "" {
		s.logger = logger.WithFields(log.Fields{
			"queue": s.Config.SQSName,

View on GitHub (pinned to 909b515798)

Solutions

  1. Add `bucket_name: my-bucket` to the s3 source config
  2. Set polling_method: sqs with sqs_name instead if you consume event notifications
  3. Verify key spelling and indentation

Example fix

// before
source: s3
polling_method: list
// after
source: s3
polling_method: list
bucket_name: my-bucket
Defensive patterns

Strategy: validation

Validate before calling

if (cfg.PollingMethod == "" || cfg.PollingMethod == "list") && cfg.BucketName == "" {
    return errors.New("bucket_name required for list polling")
}

Prevention

When it happens

Trigger: An s3 acquisition config with `polling_method: list` (the default) and an empty/missing `bucket_name`, checked in UnmarshalConfig.

Common situations: Omitting bucket_name assuming it's optional, a typo (bucket), or YAML nesting placing bucket_name outside the parsed config block.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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