flarum/framework · info

There are no entries matching this query. Aborting.

Error message

There are no entries matching this query. Aborting.

What it means

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.

Solutions

  1. Check the audit_log table for existing rows and pick a --before date after the oldest entry
  2. Run without --before to use the default cutoff
  3. Use --reset if you intend to wipe/disable the whole audit log instead
  4. No action needed if the intent was a dry run

Example fix

// before
php flarum clear:logs --before=2020-01-01
// after
php flarum clear:logs --before=2026-01-01
Defensive patterns

Strategy: validation

Validate before calling

$count = \Flarum\Audit\AuditLog::where('created_at', '<', $beforeDate)->count();
if ($count === 0) { /* nothing to clear — skip or notify */ }

Prevention

When it happens

Trigger: Running `php flarum clear:logs --before=<date>` (or with default cutoff) when the count of AuditLog rows with created_at < beforeDate is 0.

Common situations: The log table was already cleared, no audit activity exists yet, or the --before date is earlier than every log entry.

Understand the failure class

Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.

Related errors


AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15). Data as JSON: /api/errors/3fb2989d095660cf. Report an issue: GitHub.

Appendix: source

Thrown at extensions/audit/src/Console/ClearLogsCommand.php:33

use Flarum\Extension\ExtensionManager;
use Illuminate\Console\Command;
use Illuminate\Database\Connection;

class ClearLogsCommand extends Command
{
    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}';
    protected $description = 'Permanently destroy audit log entries';

    public function handle(Connection $db, ExtensionManager $manager): void
    {
        if ($before = $this->option('before')) {
            $beforeDate = Carbon::parse($before);

            $query = AuditLog::query()->where('created_at', '<', $beforeDate);
            $count = $query->count();

            if ($count === 0) {
                $this->warn('There are no entries matching this query. Aborting.');

                return;
            }

            if (! $this->option('force') && ! $this->confirm($count.' records will be deleted from the log table. Continue?')) {
                $this->warn('Aborting.');

                return;
            }

            $query->delete();
            $this->info($count.' records deleted.');
            $this->info('All done!');

            AuditLogger::log('audit_log_cleared', [
                'before' => $beforeDate->toIso8601String(),
                'deleted_count' => $count,
            ]);

View on GitHub (pinned to 4b939f6853)