{"record":{"id":"89047be58bcaaa4a","repo":"crowdsecurity/crowdsec","slug":"bucket-must-have-name","errorCode":null,"errorMessage":"bucket must have name","messagePattern":"bucket must have name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/leakybucket/manager_load.go","lineNumber":81,"sourceCode":"\tFilename            string\n\tRunTimeFilter       *vm.Program         `json:\"-\"`\n\tRunTimeGroupBy      *vm.Program         `json:\"-\"`\n\tDataDir             string\n\tleakspeed           time.Duration       // internal representation of `Leakspeed`\n\tduration            time.Duration       // internal representation of `Duration`\n\tret                 chan pipeline.Event // the bucket-specific output chan for overflows\n\tprocessors          []Processor         // processors is the list of hooks for pour/overflow/create (cf. uniq, blackhole etc.)\n\tscenarioHash        string\n\tSimulated           bool                // Set to true if the scenario instantiating the bucket was in the exclusion list\n\torderEvent          bool\n}\n\n// we use one NameGenerator for all the future buckets\nvar seed = namegenerator.NewNameGenerator(time.Now().UTC().UnixNano())\n\nfunc (f *BucketFactory) Validate() error {\n\tif f.Spec.Name == \"\" {\n\t\treturn errors.New(\"bucket must have name\")\n\t}\n\n\tif f.Spec.Description == \"\" {\n\t\treturn errors.New(\"description is mandatory\")\n\t}\n\n\timpl, ok := bucketTypes[f.Spec.Type]\n\tif !ok {\n\t\treturn fmt.Errorf(\"unknown bucket type '%s'\", f.Spec.Type)\n\t}\n\n\tif err := impl.Validate(f); err != nil {\n\t\treturn fmt.Errorf(\"%s bucket: %w\", f.Spec.Type, err)\n\t}\n\n\treturn f.Spec.ScopeType.CompileFilter()\n}\n","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/leakybucket/manager_load.go#L63-L99","documentation":"BucketFactory.Validate requires Spec.Name to be non-empty; every bucket must carry a unique name used as its identifier, key material and in alert labels. An empty name means the config item is malformed and is rejected before registration.","triggerScenarios":"Loading a bucket file whose `name:` field is missing or empty, typically via LoadBucket during hub/config load.","commonSituations":"Hand-written scenario YAML missing the name field, templating/rendering leaving `name: ''`, or a truncated config file.","solutions":["Add a non-empty `name:` to the scenario/bucket YAML","Check template rendering or ingestion scripts aren't dropping the name","Validate with `cscli hubtest` before deploying"],"exampleFix":"# before\ntype: leaky\nfilter: \"evt.Meta.log_type == 'ssh_failed-auth'\"\n# after\ntype: leaky\nname: crowdsecurity/ssh-bf\nfilter: \"evt.Meta.log_type == 'ssh_failed-auth'\"","handlingStrategy":"validation","validationCode":"if bucket.Spec.Name == \"\" {\n    return errors.New(\"scenario must define a non-empty name\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always start scenario YAML with name, description, type","Run cscli hubtest on every scenario before install","Check generated/rendered configs for empty fields"],"tags":["crowdsec","leakybucket","config-validation","missing-field"],"backgroundTag":"missing-required-config-field","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}