Skip to content

Failed to extract tags for event listener #1693

@rognales

Description

@rognales

Telescope Version

5.18.0

Laravel Version

12.46.0

PHP Version

8.4.18

Database Driver & Version

MySQL 8.4.2 on macOS 14.8 arm64 (Homebrew client: 8.4.8)

Description

Description

Telescope appears to be incompatible with Laravel Horizon's documented listener tagging signature for queued event listeners.

Horizon documents listener tagging like this:
https://laravel.com/docs/12.x/horizon#manually-tagging-event-listeners

Example:

use App\Events\OrderShipped;

class SendShipmentNotification implements ShouldQueue
{
    public function handle(OrderShipped $event): void
    {
        // ...
    }

    public function tags(OrderShipped $event): array
    {
        return ['shipment'];
    }
}

That works for Horizon, but when Telescope inspects a queued listener it calls tags() with no arguments and throws an argument count error.

From Laravel\Telescope\ExtractTags, Telescope ends up doing:

return method_exists($target, 'tags') ? $target->tags() : [];

So for a queued listener with public function tags(SomeEvent $event): array, Telescope crashes with:

Too few arguments to function App\Listeners\...\tags(), 0 passed in vendor/laravel/telescope/src/ExtractTags.php on line 102 and exactly 1 expected

Expected Behavior

Telescope should not fail when inspecting a queued listener that uses Horizon's documented tags() signature.

Steps To Reproduce

Steps

  1. Install Laravel with Horizon and Telescope enabled.
  2. Create a queued event listener implementing ShouldQueue.
  3. Add a tags(SomeEvent $event): array method exactly as documented in the Horizon docs.
  4. Dispatch the event so the queued listener runs. (don't forget to run horizon)
  5. Let Telescope record the queue activity.

Example listener:

use App\Events\OrderShipped;

class SendShipmentNotification implements ShouldQueue
{
    public function handle(OrderShipped $event): void
    {
        // ...
    }

    public function tags(OrderShipped $event): array
    {
        return ['shipment'];
    }
}

Additional Context

This is specifically about queued listeners, not regular queued jobs.

It looks like ExtractTags::tagsForListener() inspects both:

  • the listener instance created via reflection
  • the queued event payload

but explicitTags() calls tags() without arguments on each target, which breaks for listener methods that expect the event.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions