{"record":{"id":"32dc42e56e16ffa9","repo":"crowdsecurity/crowdsec","slug":"unable-to-expire-decisions-for-list-s-w","errorCode":null,"errorMessage":"unable to expire decisions for list %s : %w","messagePattern":"unable to expire decisions for list (.+?) : %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/apiserver/papi_cmd.go","lineNumber":219,"sourceCode":"\t\tunsubscribeMsg := blocklistUnsubscribe{}\n\n\t\tif err := json.Unmarshal(data, &unsubscribeMsg); err != nil {\n\t\t\treturn fmt.Errorf(\"message for '%s' contains bad data format: %w\", message.Header.OperationType, err)\n\t\t}\n\n\t\tif unsubscribeMsg.Name == \"\" {\n\t\t\treturn fmt.Errorf(\"message for '%s' contains bad data format: missing blocklist name\", message.Header.OperationType)\n\t\t}\n\n\t\tp.Logger.Infof(\"Received blocklist_unsubscribe command from PAPI, unsubscribing from blocklist %s\", unsubscribeMsg.Name)\n\n\t\tfilter := make(map[string][]string)\n\t\tfilter[\"origin\"] = []string{types.ListOrigin}\n\t\tfilter[\"scenario\"] = []string{unsubscribeMsg.Name}\n\n\t\t_, deletedDecisions, err := p.DBClient.ExpireDecisionsWithFilter(ctx, filter)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to expire decisions for list %s : %w\", unsubscribeMsg.Name, err)\n\t\t}\n\n\t\tp.Logger.Infof(\"deleted %d decisions for list %s\", len(deletedDecisions), unsubscribeMsg.Name)\n\tcase \"reauth\":\n\t\tp.Logger.Infof(\"Received reauth command from PAPI, resetting token\")\n\t\tp.apiClient.GetClient().Transport.(*apiclient.JWTTransport).ResetToken()\n\tcase \"force_pull\":\n\t\tdata, err := json.Marshal(message.Data)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tforcePullMsg := forcePull{}\n\n\t\tif err := json.Unmarshal(data, &forcePullMsg); err != nil {\n\t\t\treturn fmt.Errorf(\"message for '%s' contains bad data format: %w\", message.Header.OperationType, err)\n\t\t}\n","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/crowdsecurity/crowdsec/blob/909b5157986a2b2c2163300fdaef5ed01289f7d2/pkg/apiserver/papi_cmd.go#L201-L237","documentation":"After a valid blocklist_unsubscribe command, ManagementCmd expires all decisions with origin=lists and scenario=<blocklist name> via DBClient.ExpireDecisionsWithFilter. This error wraps any failure returned by that database operation, typically an SQLite/DB connectivity or lock problem, so the unsubscribe does not silently leave stale decisions.","triggerScenarios":"ExpireDecisionsWithFilter returns an error while deleting decisions for origin=types.ListOrigin and scenario=unsubscribeMsg.Name — e.g. database locked, disk full, or corrupted DB file.","commonSituations":"SQLite database locked by a concurrent LAPI writer; disk quota exceeded on the machine hosting the crowdsec DB; database file corruption after an unclean shutdown.","solutions":["Read the wrapped cause at the end of the error message to identify the DB failure (e.g. 'database is locked')","Stop competing crowdsec processes (cscli, other agents sharing the same data_dir) and retry","Check free disk space and permissions on the SQLite database file (default /var/lib/crowdsec/data/crowdsec.db)","If corruption is suspected, restore from backup or run sqlite3 .recover on the DB"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// verify DB is writable/healthy before processing commands\nif _, err := os.Stat(dbPath); err != nil {\n    return fmt.Errorf(\"crowdsec database not found: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := ManagementCmd(ctx, msg, p, false); err != nil {\n    if strings.Contains(err.Error(), \"unable to expire decisions\") {\n        log.Errorf(\"DB failure during unsubscribe, will retry: %v\", err)\n        return retryAfterBackoff(err)\n    }\n    return err\n}","preventionTips":["Avoid running multiple crowdsec processes sharing one SQLite DB without a lock strategy","Monitor disk space on the volume hosting crowdsec.db","Schedule DB-heavy cscli operations off-peak to reduce lock contention"],"tags":["crowdsec","database","sqlite","decision-expiration"],"backgroundTag":"database-query-failed","analyzedSha":"909b5157986a2b2c2163300fdaef5ed01289f7d2","analyzedAt":"2026-09-06T12:27:26.012Z","contentChangedAt":"2026-09-06T12:27:26.012Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}