{"record":{"id":"34a99e41d6003d25","repo":"crowdsecurity/crowdsec","slug":"empty-s3-dsn","errorCode":null,"errorMessage":"empty s3:// DSN","messagePattern":"empty s3:// DSN","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/s3/config.go","lineNumber":212,"sourceCode":"\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 {\n\t\t\treturn fmt.Errorf(\"could not parse s3 args: %w\", err)\n\t\t}\n\n\t\tfor key, value := range params {\n\t\t\tswitch key {\n\t\t\tcase \"log_level\":\n\t\t\t\tif len(value) != 1 {\n\t\t\t\t\treturn errors.New(\"expected zero or one value for 'log_level'\")\n\t\t\t\t}\n\n\t\t\t\tlvl, err := log.ParseLevel(value[0])\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn fmt.Errorf(\"unknown level %s: %w\", value[0], err)","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/s3/config.go#L194-L230","documentation":"Returned by ConfigureByDSN when an s3:// DSN has no bucket name before the optional query string (the part after stripping the s3:// scheme and splitting on '?' is empty). The source cannot run without a bucket to poll.","triggerScenarios":"Thrown at pkg/acquisition/modules/s3/config.go:212 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Put the bucket (optionally with prefix) after the scheme: s3://my-bucket/optional/prefix","Add query options after the path, e.g. s3://my-bucket?log_level=debug"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}