{"record":{"id":"05df8aec41e35d6a","repo":"crowdsecurity/crowdsec","slug":"invalid-dsn-s-for-s3-source-must-start-with-s3","errorCode":null,"errorMessage":"invalid DSN %s for S3 source, must start with s3://","messagePattern":"invalid DSN (.+?) for S3 source, must start with s3://","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/s3/config.go","lineNumber":199,"sourceCode":"\t}\n\n\ts.s3Client = client\n\n\tif s.Config.PollingMethod == PollMethodSQS {\n\t\tsqsClient, err := s.newSQSClient(ctx)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\ts.sqsClient = sqsClient\n\t}\n\n\treturn nil\n}\n\nfunc (s *Source) ConfigureByDSN(ctx context.Context, dsn string, labels map[string]string, logger *log.Entry, uuid string) error {\n\tif !strings.HasPrefix(dsn, \"s3://\") {\n\t\treturn fmt.Errorf(\"invalid DSN %s for S3 source, must start with s3://\", dsn)\n\t}\n\n\ts.Config = Configuration{}\n\ts.logger = logger.WithFields(log.Fields{\n\t\t\"bucket\": s.Config.BucketName,\n\t\t\"prefix\": s.Config.Prefix,\n\t})\n\n\tdsn = strings.TrimPrefix(dsn, \"s3://\")\n\targs := strings.Split(dsn, \"?\")\n\n\tif args[0] == \"\" {\n\t\treturn errors.New(\"empty s3:// DSN\")\n\t}\n\n\tif len(args) == 2 && args[1] != \"\" {\n\t\tparams, err := url.ParseQuery(args[1])\n\t\tif err != nil {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/s3/config.go#L181-L217","documentation":"Returned by ConfigureByDSN when the DSN given to the S3 acquisition source does not start with the required s3:// scheme prefix, i.e. the wrong datasource type was configured for this module. The offending input is the full DSN string.","triggerScenarios":"Calling ConfigureByDSN (directly or via crowdsec DSN-based acquisition) with strings like 'bucket/my-bucket', 'arn:aws:s3:::my-bucket', or a scheme-less bucket name.","commonSituations":"Programmatically building DSNs and dropping the scheme; pasting a bucket ARN or plain bucket name where a DSN is expected.","solutions":["Use s3://bucket/prefix format in the acquisition DSN","Ensure the DSN is assigned to the S3 source type"],"exampleFix":"// before\nConfigureByDSN(ctx, \"my-bucket?log_level=info\", ...)\n// after\nConfigureByDSN(ctx, \"s3://my-bucket?log_level=info\", ...)","handlingStrategy":"validation","validationCode":"if !strings.HasPrefix(dsn, \"s3://\") {\n    return fmt.Errorf(\"DSN must start with s3://, got %q\", dsn)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always build DSNs as s3://<bucket>[?options]","Convert bucket ARNs to s3:// form before passing them","Unit-test any code that generates DSN strings"],"tags":["s3","dsn","acquisition"],"backgroundTag":"invalid-url-format","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"}