{"record":{"id":"d7d8b5249fa00ebb","repo":"crowdsecurity/crowdsec","slug":"use-container-labels-and-container-name-container","errorCode":null,"errorMessage":"use_container_labels and container_name, container_id, container_id_regexp, container_name_regexp are mutually exclusive","messagePattern":"use_container_labels and container_name, container_id, container_id_regexp, container_name_regexp are mutually exclusive","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/config.go","lineNumber":73,"sourceCode":"\t\tFollowStdout: true, // default\n\t\tFollowStdErr: true, // default\n\t}\n\n\tif err := yaml.UnmarshalWithOptions(yamlConfig, &d.Config, yaml.Strict()); err != nil {\n\t\treturn fmt.Errorf(\"while parsing DockerAcquisition configuration: %s\", yaml.FormatError(err, false, false))\n\t}\n\n\tif d.logger != nil {\n\t\td.logger.Tracef(\"DockerAcquisition configuration: %+v\", d.Config)\n\t}\n\n\t// Check if we have any container or service configuration\n\tif !d.Config.hasContainerConfig() && !d.Config.hasServiceConfig() {\n\t\treturn errors.New(\"no containers or services configuration provided\")\n\t}\n\n\tif d.Config.UseContainerLabels && (len(d.Config.ContainerName) > 0 || len(d.Config.ContainerID) > 0 || len(d.Config.ContainerIDRegexp) > 0 || len(d.Config.ContainerNameRegexp) > 0) {\n\t\treturn errors.New(\"use_container_labels and container_name, container_id, container_id_regexp, container_name_regexp are mutually exclusive\")\n\t}\n\n\tif d.Config.UseServiceLabels && (len(d.Config.ServiceName) > 0 || len(d.Config.ServiceID) > 0 || len(d.Config.ServiceIDRegexp) > 0 || len(d.Config.ServiceNameRegexp) > 0) {\n\t\treturn errors.New(\"use_service_labels and service_name, service_id, service_id_regexp, service_name_regexp are mutually exclusive\")\n\t}\n\n\tif d.Config.CheckInterval != \"\" && d.logger != nil {\n\t\td.logger.Warn(\"check_interval is ignored: this datasource now uses events instead of polling (will be removed in a future version)\")\n\t}\n\n\tif d.Config.Mode == \"\" {\n\t\td.Config.Mode = configuration.TAIL_MODE\n\t}\n\n\tif d.Config.Mode != configuration.CAT_MODE && d.Config.Mode != configuration.TAIL_MODE {\n\t\treturn fmt.Errorf(\"unsupported mode %s for docker datasource\", d.Config.Mode)\n\t}\n","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/config.go#L55-L91","documentation":"Validation guard in docker UnmarshalConfig: use_container_labels is enabled while explicit container selectors (container_name, container_id, container_id_regexp, container_name_regexp) are also set. Label-based discovery and explicit selection are mutually exclusive strategies; allowing both would make the watched set ambiguous.","triggerScenarios":"Thrown at pkg/acquisition/modules/docker/config.go:73 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Either set use_container_labels: true and remove all container_* selectors, or disable it and list containers explicitly","Pick discovery-by-label when containers are ephemeral; pick explicit selectors for stable setups"],"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-14T05:17:10.506Z"}