{"record":{"id":"cde47ff1c9ae1c96","repo":"crowdsecurity/crowdsec","slug":"cannote-create-s-reader-w","errorCode":null,"errorMessage":"cannote create %s reader: %w","messagePattern":"cannote create (.+?) reader: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/kafka/config.go","lineNumber":90,"sourceCode":"func (s *Source) Configure(_ context.Context, yamlConfig []byte, logger *log.Entry, metricsLevel metrics.AcquisitionMetricsLevel) error {\n\ts.logger = logger\n\ts.metricsLevel = metricsLevel\n\n\ts.logger.Debugf(\"start configuring %s source\", s.GetName())\n\n\terr := s.UnmarshalConfig(yamlConfig)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tdialer, err := s.Config.NewDialer()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannot create %s dialer: %w\", s.GetName(), err)\n\t}\n\n\ts.Reader, err = s.Config.NewReader(dialer, s.logger)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"cannote create %s reader: %w\", s.GetName(), err)\n\t}\n\n\tif s.Reader == nil {\n\t\treturn fmt.Errorf(\"cannot create %s reader\", s.GetName())\n\t}\n\n\ts.logger.Debugf(\"successfully configured %s source\", s.GetName())\n\n\treturn nil\n}\n\nfunc (c *Configuration) NewTLSConfig() (*tls.Config, error) {\n\ttlsConfig := tls.Config{\n\t\tInsecureSkipVerify: c.TLS.InsecureSkipVerify,\n\t}\n\n\tcert, err := tls.LoadX509KeyPair(c.TLS.ClientCert, c.TLS.ClientKey)\n\tif err != nil {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/kafka/config.go#L72-L108","documentation":"Wraps any failure from Configuration.NewReader() while the kafka acquisition source is configured. NewReader can fail when both group_id and partition are set (mutually exclusive), or when kafka.ReaderConfig.Validate() rejects the combination. Note the typo 'cannote' in the message itself — searching logs for 'cannot create kafka reader' will miss it.","triggerScenarios":"Configure() calls Config.NewReader(dialer, logger) and it returns an error — specifically when a kafka acquisition yaml sets both `group_id` and a non-zero `partition`, or when kafka-go's ReaderConfig.Validate() fails (e.g. invalid Address/Group balancing config).","commonSituations":"Operator converts from partition-based to consumer-group consumption and forgets to remove `partition:`; kafka-go version where Validate() rejects some combination; copy-pasted config keeping a stale `partition: 1`.","solutions":["In the kafka acquisition yaml, keep only one of `group_id` or `partition` — they are mutually exclusive","Remove the `partition:` key if you intend consumer-group semantics; partition mode also only reads a single partition","Check the wrapped %w error in logs: 'cannot specify both group_id and partition' vs a Validate() message","Read the yaml with strict parsing (CrowdSec already does) to confirm no unexpected keys cause a mis-parse"],"exampleFix":"// before\nsource: kafka\nbrokers: [broker:9092]\ntopic: crowdsec\ngroup_id: crowdsec\npartition: 1   # mutually exclusive\n// after\nsource: kafka\nbrokers: [broker:9092]\ntopic: crowdsec\ngroup_id: crowdsec","handlingStrategy":"validation","validationCode":"if cfg.GroupID != \"\" && cfg.Partition != 0 {\n    return errors.New(\"kafka: group_id and partition are mutually exclusive\")\n}","typeGuard":null,"tryCatchPattern":"if err := src.Configure(ctx, yamlCfg, logger, lvl); err != nil {\n    if strings.Contains(err.Error(), \"both group_id and partition\") {\n        logger.Error(\"fix acquisition yaml: drop either group_id or partition\")\n    }\n    return err\n}","preventionTips":["Pick consumption mode (group_id OR partition) up front and keep only that key","Grep your acquis yaml for both keys when upgrading configs","Remember partition 0 is the zero-value, so `partition: 0` silently means 'no partition'"],"tags":["kafka","config","crowdsec"],"backgroundTag":"conflicting-config-options","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"}