{"record":{"id":"3fb2989d095660cf","repo":"flarum/framework","slug":"there-are-no-entries-matching-this-query-aborting","errorCode":null,"errorMessage":"There are no entries matching this query. Aborting.","messagePattern":"There are no entries matching this query\\. Aborting\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"info","filePath":"extensions/audit/src/Console/ClearLogsCommand.php","lineNumber":33,"sourceCode":"use Flarum\\Extension\\ExtensionManager;\nuse Illuminate\\Console\\Command;\nuse Illuminate\\Database\\Connection;\n\nclass ClearLogsCommand extends Command\n{\n    protected $signature = 'audit:clear {--before= : Delete entries older than the specified date. Any Carbon syntax is supported} {--reset : Delete all data, database tables and disable extension} {--force : Don\\'t ask for confirmation}';\n    protected $description = 'Permanently destroy audit log entries';\n\n    public function handle(Connection $db, ExtensionManager $manager): void\n    {\n        if ($before = $this->option('before')) {\n            $beforeDate = Carbon::parse($before);\n\n            $query = AuditLog::query()->where('created_at', '<', $beforeDate);\n            $count = $query->count();\n\n            if ($count === 0) {\n                $this->warn('There are no entries matching this query. Aborting.');\n\n                return;\n            }\n\n            if (! $this->option('force') && ! $this->confirm($count.' records will be deleted from the log table. Continue?')) {\n                $this->warn('Aborting.');\n\n                return;\n            }\n\n            $query->delete();\n            $this->info($count.' records deleted.');\n            $this->info('All done!');\n\n            AuditLogger::log('audit_log_cleared', [\n                'before' => $beforeDate->toIso8601String(),\n                'deleted_count' => $count,\n            ]);","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/flarum/framework/blob/4b939f685389bfe8a380e9e28ddf305a1c66950c/extensions/audit/src/Console/ClearLogsCommand.php#L15-L51","documentation":"The audit extension's `clear:logs` (ClearLogsCommand) counts audit_log rows older than the given `--before` date; if none match, the command warns and exits early without deleting anything. It is an informational guard, not a thrown exception.","triggerScenarios":"Running `php flarum clear:logs --before=<date>` (or with default cutoff) when the count of AuditLog rows with created_at < beforeDate is 0.","commonSituations":"The log table was already cleared, no audit activity exists yet, or the --before date is earlier than every log entry.","solutions":["Check the audit_log table for existing rows and pick a --before date after the oldest entry","Run without --before to use the default cutoff","Use --reset if you intend to wipe/disable the whole audit log instead","No action needed if the intent was a dry run"],"exampleFix":"// before\nphp flarum clear:logs --before=2020-01-01\n// after\nphp flarum clear:logs --before=2026-01-01","handlingStrategy":"validation","validationCode":"$count = \\Flarum\\Audit\\AuditLog::where('created_at', '<', $beforeDate)->count();\nif ($count === 0) { /* nothing to clear — skip or notify */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Query the audit_log count before scheduling prune commands","Choose --before dates relative to actual log activity","Treat exit with no deletion as success in automation"],"tags":["cli","audit-log","empty-result"],"backgroundTag":"empty-result-set","analyzedSha":"4b939f685389bfe8a380e9e28ddf305a1c66950c","analyzedAt":"2026-09-15T18:09:20.879Z","contentChangedAt":"2026-09-15T18:09:20.879Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}