crowdsecurity/crowdsec · warning
ErrFeatureDeprecated
ErrFeatureDeprecated
Error message
the flag is deprecated
What it means
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.
Source
Thrown at pkg/fflag/features.go:47
import (
"errors"
"fmt"
"io"
"os"
"regexp"
"sort"
"strings"
"github.com/goccy/go-yaml"
"github.com/sirupsen/logrus"
)
var (
ErrFeatureNameEmpty = errors.New("name is empty")
ErrFeatureNameCase = errors.New("name is not lowercase")
ErrFeatureNameInvalid = errors.New("invalid name (allowed a-z, 0-9, _, .)")
ErrFeatureUnknown = errors.New("unknown feature")
ErrFeatureDeprecated = errors.New("the flag is deprecated")
ErrFeatureRetired = errors.New("the flag is retired")
)
const (
ActiveState = iota // the feature can be enabled, and its description is logged (Info)
DeprecatedState // the feature can be enabled, and a deprecation message is logged (Warning)
RetiredState // the feature is ignored and a deprecation message is logged (Error)
)
type Feature struct {
Name string
State int // active, deprecated, retired
// Description should be a short sentence, explaining the feature.
Description string
// DeprecationMessage is used to inform the user of the behavior that has
// been decided when the flag is/was finally retired.View on GitHub (pinned to 909b515798)
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
Example fix
// before feature-flags: old_flag_name: true // after # remove the entry; feature is on by default now
Defensive patterns
Strategy: try-catch
Validate before calling
if feat, err := fflag.GetFeature(name); err == nil && feat.State == fflag.DeprecatedState { log.Warn("flag deprecated: " + feat.DeprecationMsg) } Try / catch
if err := fflag.Set(name); errors.Is(err, fflag.ErrFeatureDeprecated) { log.Warnf("%s is deprecated: %s", name, feat.DeprecationMsg) } Prevention
- Heed deprecation warnings at startup and migrate promptly
- Review DeprecationMsg strings in pkg/fflag for migration targets
- Remove deprecated flags from config proactively
When it happens
Trigger: Set, SetFromEnv or SetFromYaml called on a feature flagged DeprecatedState; e.g. FFLAGS-style env var naming a deprecated feature at startup.
Common situations: Config carried over from an older crowdsec where a feature was still active but is now deprecated; CI scripts setting deprecated flags programmatically.
Understand the failure class
Background: "is deprecated and will be removed" — deprecation warnings for old API names, keywords, and options, and how to migrate before the removal release — this error's family across 29 libraries.
Related errors
- ErrFeatureRetired
- ErrFeatureNameInvalid
- ErrFeatureUnknown
- feature flag '%s': %w
- failed to parse feature flags: %w
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/1b0d1d96b7c1f5fa.
Report an issue: GitHub.