{"record":{"id":"39e02e8d057f7518","repo":"crowdsecurity/crowdsec","slug":"bucket-name-and-sqs-name-are-mutually-exclusive","errorCode":null,"errorMessage":"bucket_name and sqs_name are mutually exclusive","messagePattern":"bucket_name and sqs_name are mutually exclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/s3/config.go","lineNumber":135,"sourceCode":"\n\tif s.Config.PollingMethod == \"\" {\n\t\ts.Config.PollingMethod = PollMethodList\n\t}\n\n\tif s.Config.PollingInterval == 0 {\n\t\ts.Config.PollingInterval = 60\n\t}\n\n\tif s.Config.MaxBufferSize == 0 {\n\t\ts.Config.MaxBufferSize = bufio.MaxScanTokenSize\n\t}\n\n\tif s.Config.PollingMethod != PollMethodList && s.Config.PollingMethod != PollMethodSQS {\n\t\treturn fmt.Errorf(\"invalid polling method %s\", s.Config.PollingMethod)\n\t}\n\n\tif s.Config.BucketName != \"\" && s.Config.SQSName != \"\" {\n\t\treturn errors.New(\"bucket_name and sqs_name are mutually exclusive\")\n\t}\n\n\tif s.Config.PollingMethod == PollMethodSQS && s.Config.SQSName == \"\" {\n\t\treturn errors.New(\"sqs_name is required when using sqs polling method\")\n\t}\n\n\tif s.Config.BucketName == \"\" && s.Config.PollingMethod == PollMethodList {\n\t\treturn errors.New(\"bucket_name is required\")\n\t}\n\n\tif s.Config.SQSFormat != \"\" && s.Config.SQSFormat != SQSFormatEventBridge && s.Config.SQSFormat != SQSFormatS3Notification && s.Config.SQSFormat != SQSFormatSNS {\n\t\treturn fmt.Errorf(\"invalid sqs_format %s, must be empty, %s, %s or %s\", s.Config.SQSFormat, SQSFormatEventBridge, SQSFormatS3Notification, SQSFormatSNS)\n\t}\n\n\treturn nil\n}\n\nfunc (s *Source) Configure(ctx context.Context, yamlConfig []byte, logger *log.Entry, _ metrics.AcquisitionMetricsLevel) error {","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/s3/config.go#L117-L153","documentation":"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.","triggerScenarios":"An s3.yaml acquisition config containing non-empty values for both `bucket_name` and `sqs_name`, after polling-method validation in UnmarshalConfig.","commonSituations":"Merging two example configs, adding an sqs_name to an existing bucket config without removing bucket_name, or templating that filled both fields.","solutions":["Keep only sqs_name if you consume S3 events via SQS","Keep only bucket_name if you use list polling","Split into two separate acquisition files if you need both"],"exampleFix":"// before\nbucket_name: my-bucket\nsqs_name: my-queue\n// after\nbucket_name: my-bucket","handlingStrategy":"validation","validationCode":"if cfg.BucketName != \"\" && cfg.SQSName != \"\" {\n    return errors.New(\"set either bucket_name or sqs_name, not both\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use separate acquisition files per polling mode","Review merged configs for duplicated keys","Template only one of the two fields"],"tags":["config","s3","validation"],"backgroundTag":"mutually-exclusive-options","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}