crowdsecurity/crowdsec · error

ErrFeatureRetired

ErrFeatureRetired

Error message

the flag is retired

What it means

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.

Source

Thrown at pkg/fflag/features.go:48

	"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.
	DeprecationMsg string

View on GitHub (pinned to 909b515798)

Solutions

  1. Delete the retired flag from your configuration and environment
  2. Follow the logged DeprecationMsg to whatever replaced the feature
  3. Re-check config after each crowdsec upgrade to drop retired flags

Example fix

// before
Environment=CROWDSEC_FEATURES=retired_flag
// after
# entry removed; flag is retired and ignored
Defensive patterns

Strategy: try-catch

Validate before calling

if feat, err := fflag.GetFeature(name); err == nil && feat.State == fflag.RetiredState { log.Warn("flag retired, remove it: " + feat.DeprecationMsg) }

Try / catch

if err := fflag.Set(name); errors.Is(err, fflag.ErrFeatureRetired) { log.Errorf("ignoring retired flag %s: %s", name, feat.DeprecationMsg) }

Prevention

When it happens

Trigger: 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.

Common situations: Long-lived config.yaml or systemd Environment= line still setting a flag retired months earlier; upgrade without config cleanup.

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


AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06). Data as JSON: /api/errors/ebb6ec69d87a9538. Report an issue: GitHub.