{"record":{"id":"1b0d1d96b7c1f5fa","repo":"crowdsecurity/crowdsec","slug":"errfeaturedeprecated","errorCode":"ErrFeatureDeprecated","errorMessage":"the flag is deprecated","messagePattern":"the flag is deprecated","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"pkg/fflag/features.go","lineNumber":47,"sourceCode":"import (\n\t\"errors\"\n\t\"fmt\"\n\t\"io\"\n\t\"os\"\n\t\"regexp\"\n\t\"sort\"\n\t\"strings\"\n\n\t\"github.com/goccy/go-yaml\"\n\t\"github.com/sirupsen/logrus\"\n)\n\nvar (\n\tErrFeatureNameEmpty   = errors.New(\"name is empty\")\n\tErrFeatureNameCase    = errors.New(\"name is not lowercase\")\n\tErrFeatureNameInvalid = errors.New(\"invalid name (allowed a-z, 0-9, _, .)\")\n\tErrFeatureUnknown     = errors.New(\"unknown feature\")\n\tErrFeatureDeprecated  = errors.New(\"the flag is deprecated\")\n\tErrFeatureRetired     = errors.New(\"the flag is retired\")\n)\n\nconst (\n\tActiveState     = iota // the feature can be enabled, and its description is logged (Info)\n\tDeprecatedState        // the feature can be enabled, and a deprecation message is logged (Warning)\n\tRetiredState           // the feature is ignored and a deprecation message is logged (Error)\n)\n\ntype Feature struct {\n\tName  string\n\tState int // active, deprecated, retired\n\n\t// Description should be a short sentence, explaining the feature.\n\tDescription string\n\n\t// DeprecationMessage is used to inform the user of the behavior that has\n\t// been decided when the flag is/was finally retired.","sourceCodeStart":29,"sourceCodeEnd":65,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/fflag/features.go#L29-L65","documentation":"Sentinel error ErrFeatureDeprecated returned when enabling a feature whose State is DeprecatedState. The flag is still applied (Set sets it anyway), but callers should warn with feat.DeprecationMsg since the flag will be removed in a future release.","triggerScenarios":"Set, SetFromEnv or SetFromYaml called on a feature flagged DeprecatedState; e.g. FFLAGS-style env var naming a deprecated feature at startup.","commonSituations":"Config carried over from an older crowdsec where a feature was still active but is now deprecated; CI scripts setting deprecated flags programmatically.","solutions":["Read the DeprecationMsg logged at startup and migrate to the replacement flag or built-in behavior","Remove the deprecated flag from config.yaml / env since enabling it is now a no-op with warning","Plan upgrade: deprecated flags become retired (ignored) in later releases"],"exampleFix":"// before\nfeature-flags:\n  old_flag_name: true\n// after\n# remove the entry; feature is on by default now","handlingStrategy":"try-catch","validationCode":"if feat, err := fflag.GetFeature(name); err == nil && feat.State == fflag.DeprecatedState { log.Warn(\"flag deprecated: \" + feat.DeprecationMsg) }","typeGuard":null,"tryCatchPattern":"if err := fflag.Set(name); errors.Is(err, fflag.ErrFeatureDeprecated) { log.Warnf(\"%s is deprecated: %s\", name, feat.DeprecationMsg) }","preventionTips":["Heed deprecation warnings at startup and migrate promptly","Review DeprecationMsg strings in pkg/fflag for migration targets","Remove deprecated flags from config proactively"],"tags":["go","feature-flags","deprecation"],"backgroundTag":"deprecated-api-usage","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"}