Skip to content

Schedule tasks fail on Panel v1.12.1 with Laravel 11 (RunTaskJob dispatch broken) #5600

@Xgabi86

Description

@Xgabi86

Current Behavior

Schedules fail to execute on Panel v1.12.1 with Laravel 11. When triggered automatically, tasks immediately fail with Call to undefined function Illuminate\Support\enum_value(). When triggered manually via the Panel, the error is RunTaskJob::__construct(): Argument #1 ($task) must be of type Pterodactyl\Models\Task, RunTaskJob given.

Expected Behavior

Schedules should execute all tasks in sequence (send commands with delays, then restart) without errors.

Steps to Reproduce

  1. Run Panel v1.12.1 with Laravel 11 (composer.lock ships with laravel/framework v11.x)
  2. Create a schedule with multiple tasks (e.g. several send command actions with delays, followed by a restart)
  3. Trigger the schedule manually or wait for automatic execution
  4. Observe the schedule stuck on Processing or returning a generic error

Three bugs were identified and patched manually:

Fix 1ProcessScheduleService.php: dispatchNow() was removed in Laravel 11, replace with dispatchSync()

// Before
$this->dispatcher->dispatchNow($job);
// After
$this->dispatcher->dispatchSync($job);

Fix 2RunTaskJob.php: failed() signature uses ?\Exception but Laravel 11 passes \Throwable, causing a TypeError

// Before
public function failed(?\Exception $exception = null)
// After
public function failed(?\Throwable $exception = null)

Fix 3RunTaskJob.php: The class uses only the Queueable trait but not Dispatchable, so self::dispatch() in queueNextTask() is unavailable or behaves incorrectly. Adding Dispatchable and fixing the dispatch call resolves the issue.

// Add import
use Illuminate\Foundation\Bus\Dispatchable;

// Add to class
use Dispatchable, Queueable;

// Fix queueNextTask()
// Before
self::dispatch((new self($nextTask, $this->manualRun))->delay($nextTask->time_offset));
// After
self::dispatch($nextTask, $this->manualRun)->delay($nextTask->time_offset);

Panel Version

1.12.1

Wings Version

1.12.1

Games and/or Eggs Affected

All eggs / all servers (schedule system is global)

Docker Image

N/A

Error Logs

https://ptero.co/AvWPft

Is there an existing issue for this?

  • I have searched the existing issues before opening this issue. I understand that maintainers may close this issue without communication if I have not provided sufficient information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions