{"record":{"id":"884e2c453a1991d3","repo":"crowdsecurity/crowdsec","slug":"unsupported-mode-s-for-docker-datasource","errorCode":null,"errorMessage":"unsupported mode %s for docker datasource","messagePattern":"unsupported mode (.+?) for docker datasource","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/acquisition/modules/docker/config.go","lineNumber":89,"sourceCode":"\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\n\tfor _, cont := range d.Config.ContainerNameRegexp {\n\t\tcompiled, err := regexp.Compile(cont)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"container_name_regexp: %w\", err)\n\t\t}\n\n\t\td.compiledContainerName = append(d.compiledContainerName, compiled)\n\t}\n\n\tfor _, cont := range d.Config.ContainerIDRegexp {\n\t\tcompiled, err := regexp.Compile(cont)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"container_id_regexp: %w\", err)\n\t\t}\n\n\t\td.compiledContainerID = append(d.compiledContainerID, compiled)","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/acquisition/modules/docker/config.go#L71-L107","documentation":"The docker datasource supports only `cat` and `tail` modes (defaulting to tail). After unmarshalling, UnmarshalConfig validates d.Config.Mode and returns `unsupported mode <mode> for docker datasource` for anything else, refusing to configure the datasource.","triggerScenarios":"Acquisition YAML sets `mode: follow`, `mode: read`, or any string other than cat/tail in a docker datasource block.","commonSituations":"Copying `mode:` from datasources with richer mode sets (e.g. journald/kafka variants); typo like `mode: tial`; misunderstanding that empty mode means tail.","solutions":["Set mode to `tail` (follow logs continuously) or `cat` (read once to the end)","Remove the mode key entirely to get the default tail behavior","Check for typos and lowercase spelling — values are compared exactly"],"exampleFix":"// before\nsource: docker\n  mode: follow\n// after\nsource: docker\n  mode: tail","handlingStrategy":"validation","validationCode":"mode := cfg.Mode\nif mode == \"\" { mode = \"tail\" }\nif mode != \"cat\" && mode != \"tail\" { return fmt.Errorf(\"docker mode must be cat or tail, got %q\", mode) }","typeGuard":null,"tryCatchPattern":"if err := ds.UnmarshalConfig(cfgYaml); err != nil {\n    if strings.Contains(err.Error(), \"unsupported mode\") { /* default to tail or correct the yaml */ }\n    return err\n}","preventionTips":["Only set mode when you specifically need cat (one-shot) semantics","Lowercase mode values exactly: 'cat' or 'tail'","Don't copy mode values from other datasource types"],"tags":["config","docker","mode","validation"],"backgroundTag":"invalid-enum-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"}