Feature Flag Debt
Feature flags enable safe rollouts — deploy code behind a flag, enable for 1% of users, monitor, then roll out fully. The practice is sound. The problem is what happens after. Flags that were meant to be temporary become permanent. Nobody removes them because nobody knows if they're still needed. The codebase accumulates hundreds of flags, creating a combinatorial explosion of code paths that are never tested together. The safety mechanism becomes a source of bugs.
What people believe
“Feature flags enable safe, controlled rollouts without long-term costs.”
| Metric | Before | After | Delta |
|---|---|---|---|
| Stale feature flags in codebase | 0 | 50-200+ | Accumulating |
| Untested code path combinations | Manageable | Exponential (2^N) | Untestable |
| Time to understand code with flags | Baseline | +30-50% | +40% |
| Bugs from flag interactions | Zero | 5-10% of production incidents | New bug category |
Don't If
- •You don't have a process for removing flags after rollout completes
- •Your team treats feature flags as permanent configuration rather than temporary deployment tools
If You Must
- 1.Set expiration dates on every flag — auto-alert when a flag is older than 30 days
- 2.Assign an owner to every flag — ownership transfers when people leave
- 3.Run regular flag cleanup sprints — treat stale flags like technical debt
- 4.Limit total active flags — set a hard cap and enforce it
Alternatives
- Branch by abstraction — Use code abstractions instead of runtime flags — cleaner, testable, no flag debt
- Short-lived feature branches — Small, frequent merges with trunk-based development — less need for flags
- Canary deployments — Deploy to a subset of infrastructure rather than flagging in code — no code complexity
This analysis is wrong if:
- Organizations with 100+ feature flags experience no increase in production incidents from flag interactions
- Stale feature flags are consistently removed within 30 days of full rollout without dedicated cleanup effort
- Combinatorial code paths from feature flags are fully tested in CI without exponential test growth
- 1.Martin Fowler: Feature Toggles
Canonical reference on feature flag categories and the importance of managing flag lifecycle
- 2.LaunchDarkly: Feature Flag Best Practices
Industry guidance on flag management including lifecycle, ownership, and cleanup
- 3.Google: Testing with Feature Flags at Scale
Google's experience managing thousands of flags and the combinatorial testing challenge
- 4.Knight Capital: $440M Loss from Flag Misconfiguration
A stale feature flag contributed to Knight Capital's $440M loss in 45 minutes
This is a mirror — it shows what's already true.
Want to surface the hidden consequences of your engineering decisions?