{"record":{"id":"ebb6ec69d87a9538","repo":"crowdsecurity/crowdsec","slug":"errfeatureretired","errorCode":"ErrFeatureRetired","errorMessage":"the flag is retired","messagePattern":"the flag is retired","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/fflag/features.go","lineNumber":48,"sourceCode":"\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.\n\tDeprecationMsg string","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/fflag/features.go#L30-L66","documentation":"Sentinel error ErrFeatureRetired returned when setting a feature whose State is RetiredState. Unlike deprecated flags, retired flags are fully ignored — the value is not applied and callers log the message at Error level with feat.DeprecationMsg.","triggerScenarios":"Set, SetFromEnv or SetFromYaml called on a feature marked RetiredState, e.g. a stale env var or config entry naming a flag that has been removed from the codebase's active set.","commonSituations":"Long-lived config.yaml or systemd Environment= line still setting a flag retired months earlier; upgrade without config cleanup.","solutions":["Delete the retired flag from your configuration and environment","Follow the logged DeprecationMsg to whatever replaced the feature","Re-check config after each crowdsec upgrade to drop retired flags"],"exampleFix":"// before\nEnvironment=CROWDSEC_FEATURES=retired_flag\n// after\n# entry removed; flag is retired and ignored","handlingStrategy":"try-catch","validationCode":"if feat, err := fflag.GetFeature(name); err == nil && feat.State == fflag.RetiredState { log.Warn(\"flag retired, remove it: \" + feat.DeprecationMsg) }","typeGuard":null,"tryCatchPattern":"if err := fflag.Set(name); errors.Is(err, fflag.ErrFeatureRetired) { log.Errorf(\"ignoring retired flag %s: %s\", name, feat.DeprecationMsg) }","preventionTips":["Delete retired flags from config.yaml and environment on upgrade","Treat startup Error-level log lines about retired flags as cleanup tasks","Script a periodic grep of your config against the current feature list"],"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"}