crowdsecurity/crowdsec · error
expiring decisions error: %w
Error message
expiring decisions error: %w
What it means
While processing the CAPI decisions stream deletions (HandleDeletedDecisionsV3), expiring one deleted decision in the local database via ExpireDecisionsWithFilter failed. The CAPI stream itself was received fine; the failure is the local DB expire of a decision value in a given scope.
Source
Thrown at pkg/apiserver/apic.go:466
func (a *apic) HandleDeletedDecisionsV3(ctx context.Context, deletedDecisions []*modelscapi.GetDecisionsStreamResponseDeletedItem, deleteCounters map[string]map[string]int) (int, error) {
var nbDeleted int
for _, decisions := range deletedDecisions {
scope := decisions.Scope
for _, decision := range decisions.Decisions {
filter := map[string][]string{
"value": {decision},
"origin": {types.CAPIOrigin},
}
if strings.ToLower(*scope) != "ip" {
filter["scopes"] = []string{*scope}
}
dbCliDel, _, err := a.dbClient.ExpireDecisionsWithFilter(ctx, filter)
if err != nil {
return 0, fmt.Errorf("expiring decisions error: %w", err)
}
updateCounterForDecision(deleteCounters, new(types.CAPIOrigin), nil, dbCliDel)
nbDeleted += dbCliDel
}
}
return nbDeleted, nil
}
func createAlertForDecision(decision *models.Decision, kind types.AlertKind) *models.Alert {
var (
scenario string
scope string
)
switch *decision.Origin {View on GitHub (pinned to 909b515798)
Solutions
- Inspect the wrapped error for the DB cause (deadlock, timeout, constraint)
- Check DB health and capacity — the delete runs per-decision in a loop, so slow DBs can time out
- If persistent, note the failing decision value/scope and check for bad data from CAPI
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at pkg/apiserver/apic.go:466 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of crowdsecurity/crowdsec@909b515798 (2026-09-06).
Data as JSON: /api/errors/36e5fa2cbc83a0f6.
Report an issue: GitHub.