{"record":{"id":"19b1ff3df8113802","repo":"crowdsecurity/crowdsec","slug":"file-s-s","errorCode":null,"errorMessage":"file %s: %s","messagePattern":"file (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/csconfig/fflag.go","lineNumber":32,"sourceCode":"func LoadFeatureFlagsEnv(logger *log.Logger) error {\n\treturn fflag.Crowdsec.SetFromEnv(logger)\n}\n\n// FeatureFlagsFileLocation returns the path to the feature.yaml file.\n// The file is in the same directory as config.yaml, which is provided\n// as the fist parameter. This can be different than ConfigPaths.ConfigDir\n// because we have not read config.yaml yet so we don't know the value of ConfigDir.\nfunc GetFeatureFilePath(configPath string) string {\n\tdir := filepath.Dir(configPath)\n\treturn filepath.Join(dir, \"feature.yaml\")\n}\n\n// LoadFeatureFlags parses feature.yaml to enable feature flags.\nfunc LoadFeatureFlagsFile(configPath string, logger *log.Logger) error {\n\tfeaturePath := GetFeatureFilePath(configPath)\n\n\tif err := fflag.Crowdsec.SetFromYamlFile(featurePath, logger); err != nil {\n\t\treturn fmt.Errorf(\"file %s: %s\", featurePath, err)\n\t}\n\treturn nil\n}\n\n// ListFeatureFlags returns a list of the enabled feature flags.\nfunc ListFeatureFlags() string {\n\tenabledFeatures := fflag.Crowdsec.GetEnabledFeatures()\n\n\tmsg := \"none\"\n\tif len(enabledFeatures) > 0 {\n\t\tmsg = strings.Join(enabledFeatures, \", \")\n\t}\n\n\treturn msg\n}\n","sourceCodeStart":14,"sourceCodeEnd":48,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/csconfig/fflag.go#L14-L48","documentation":"LoadFeatureFlagsFile reads the feature.yaml file and feeds it to fflag.Crowdsec.SetFromYamlFile, which parses and applies the feature flag definitions. Any parse/validation failure from that call is wrapped with the file path so the operator knows which file is broken. Until this succeeds, feature flags are not applied to the command run.","triggerScenarios":"feature.yaml at GetFeatureFilePath(configPath) contains invalid YAML, unknown field names, or a wrong value type for a flag — SetFromYamlFile rejects it and the error is wrapped here.","commonSituations":"Hand-edited feature.yaml with tabs instead of spaces, a flag name misspelled or removed in a newer crowdsec version, or a value given as a string where a boolean/list is expected.","solutions":["Validate feature.yaml with `yamllint /etc/crowdsec/feature.yaml` to find syntax errors (tabs, bad indentation).","Check flag names against the flags supported by your crowdsec version (`cscli version`); unknown flags in KnownFields mode fail parsing.","Temporarily move feature.yaml away and rerun; then re-add flags one at a time to find the offending one.","Restore a pristine copy of feature.yaml from upstream config and reapply your changes."],"exampleFix":"// before (feature.yaml, tab indentation)\n\talert:\n\t  flush:\n// after\nalert:\n  flush:","handlingStrategy":"try-catch","validationCode":"if _, err := os.Stat(featurePath); err != nil {\n    log.Printf(\"feature.yaml missing at %s: %v\", featurePath, err)\n}\nif data, err := os.ReadFile(featurePath); err == nil {\n    var v map[string]any\n    if err := yaml.Unmarshal(data, &v); err != nil {\n        log.Printf(\"feature.yaml invalid: %v\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := csconfig.LoadFeatureFlagsFile(cfgPath, logger); err != nil {\n    logger.Printf(\"feature flags not applied: %v\", err) // decide to abort or continue with defaults\n}","preventionTips":["Lint feature.yaml with yamllint in CI before shipping config changes.","Re-check feature names against the release notes on every crowdsec upgrade.","Keep feature.yaml minimal — only flags you actually need."],"tags":["yaml","feature-flags","config"],"backgroundTag":"yaml-parse-error","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"}