{"record":{"id":"ee6e989bc15a1565","repo":"crowdsecurity/crowdsec","slug":"crowdsec-enable-not-true","errorCode":null,"errorMessage":"crowdsec.enable not true","messagePattern":"crowdsec\\.enable not true","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"info","filePath":"pkg/acquisition/modules/docker/source.go","lineNumber":97,"sourceCode":"\tif len(parsedLabels) == 0 {\n\t\td.logger.Tracef(\"%s has no 'crowdsec' labels set, ignoring %s: %s\", entityType, entityType, entityID)\n\t\treturn nil, errors.New(\"no crowdsec labels\")\n\t}\n\n\tif _, ok := parsedLabels[\"enable\"]; !ok {\n\t\td.logger.Errorf(\"%s has 'crowdsec' labels set but no 'crowdsec.enable' key found\", entityType)\n\t\treturn nil, errors.New(\"no crowdsec.enable key\")\n\t}\n\n\tenable, ok := parsedLabels[\"enable\"].(string)\n\tif !ok {\n\t\td.logger.Errorf(\"%s has 'crowdsec.enable' label set but it's not a string\", entityType)\n\t\treturn nil, errors.New(\"crowdsec.enable not a string\")\n\t}\n\n\tif strings.ToLower(enable) != \"true\" {\n\t\td.logger.Debugf(\"%s has 'crowdsec.enable' label not set to true ignoring %s: %s\", entityType, entityType, entityID)\n\t\treturn nil, errors.New(\"crowdsec.enable not true\")\n\t}\n\n\tif _, ok = parsedLabels[\"labels\"]; !ok {\n\t\td.logger.Errorf(\"%s has 'crowdsec.enable' label set to true but no 'labels' keys found\", entityType)\n\t\treturn nil, errors.New(\"no labels key\")\n\t}\n\n\tlabelsTypeCast, ok := parsedLabels[\"labels\"].(map[string]any)\n\tif !ok {\n\t\td.logger.Errorf(\"%s has 'crowdsec.enable' label set to true but 'labels' is not a map\", entityType)\n\t\treturn nil, errors.New(\"labels not a map\")\n\t}\n\n\td.logger.Debugf(\"%s labels %+v\", entityType, labelsTypeCast)\n\n\tlabels := make(map[string]string)\n\n\tfor k, v := range labelsTypeCast {","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/source.go#L79-L115","documentation":"The container/service has crowdsec.enable set, but its value is not the string \"true\" (case-insensitive), so the entity is intentionally not acquired. This is the normal opt-in gate returning a sentinel error rather than a malfunction; the source logs it at Debug level because opting out is expected behavior.","triggerScenarios":"processCrowdsecLabels (via EvalContainer/EvalService) reads crowdsec.enable with a value other than true after ToLower — e.g. enable=false, enable=yes, enable=1, or an empty string.","commonSituations":"User set crowdsec.enable=false to disable acquisition but expects logs anyway; used 'yes' or '1' assuming truthy handling; leftover enable label from a decommissioned setup; variable expansion left the label empty.","solutions":["Set crowdsec.enable=true (any casing) on the container/service","If acquisition is unwanted, remove the crowdsec.enable label entirely and silence the noise at the source","Replace unsupported truthy spellings (yes/1/on) with the literal string true","Re-check the container's resolved labels with 'docker inspect' to catch template/env expansion issues"],"exampleFix":"# before\nlabels:\n  - crowdsec.enable=yes\n# after\nlabels:\n  - crowdsec.enable=true","handlingStrategy":"validation","validationCode":"if v, ok := labels[\"crowdsec.enable\"]; ok && strings.ToLower(v) != \"true\" {\n\tlog.Infof(\"container %s: crowdsec disabled (enable=%s), skipping\", ctr.ID, v)\n}","typeGuard":"func isEnabled(labels map[string]string) bool {\n\treturn strings.EqualFold(labels[\"crowdsec.enable\"], \"true\")\n}","tryCatchPattern":"if _, err := source.EvalContainer(ctx, ctr); err != nil {\n\tif err.Error() == \"crowdsec.enable not true\" {\n\t\t// expected opt-out: not an error condition\n\t\treturn nil\n\t}\n\treturn err\n}","preventionTips":["Use exactly the literal true (any casing) — not yes/1/on","Remember enable=false means deliberate opt-out, not a bug","Check env-substituted compose files for empty label values"],"tags":["docker","labels","configuration"],"backgroundTag":"invalid-config-value","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"}