AbstractQueuedJob argument $job must be of type QueuedJob

SilverStripe 4.10:

I am trying to create my own Symbiote\QueuedJobs job but I’m missing something (probably really simple!)

  • I have confirmed the original Symbiote\QueuedJobs\Tasks\DummyQueuedJob runs and completes correctly when adding it using the CMS “Jobs” section.

  • I have copied the DummyQueuedJob to my own module as a test and changed the namespace and nothing else.

  • I have confirmed the copy of the job appears in the Jobs section drop-down.

  • I have added my test job to the queue and received a message saying it has successfully been queued.

But it stays with a status of “New” indefinitely and the following error appears in the logs:

ERROR [Emergency]: Uncaught TypeError: Symbiote\QueuedJobs\Services\QueuedJobService::handleBrokenJobException(): Argument #2 ($job) must be of type Symbiote\QueuedJobs\Services\QueuedJob, null given, called in /var/www/localhost/htdocs/vendor/symbiote/silverstripe-queuedjobs/src/Services/QueuedJobService.php on line 996

I feel like I should be adding something somewhere else to get it to run but can’t see where that should be? Can anyone point me in the right direction?

Thanks :slightly_smiling_face:

Can you please post the code for your class? It’s hard to diagnose a code problem without seeing the code. ;p

Here you go - it is the DummyQueuedJob supplied with the QueuedJobs module:


namespace <my namespace here>;

use SilverStripe\ORM\FieldType\DBDatetime;
use Symbiote\QueuedJobs\Services\AbstractQueuedJob;
use Symbiote\QueuedJobs\Services\QueuedJob;

class DummyQueuedJob extends AbstractQueuedJob
     * @param int $number
    public function __construct($number = 0)
        if ($number) {
            $this->startNumber = $number;
            $this->totalSteps = $this->startNumber;

     * @return string
    public function getTitle()
        return 'Some test job for ' . $this->startNumber . ' seconds';

     * @return string
    public function getJobType()
        return QueuedJob::QUEUED;

    public function setup()
       // just demonstrating how to get a job going...
        $this->totalSteps = $this->startNumber;
        $this->times = array();

    public function process()
        $times = $this->times;

        // needed due to quirks with __set
        $time = DBDatetime::now()->Rfc2822();
        $times[] = $time;
        $this->times = $times;
        $this->addMessage('Updated time to ' . $time);

        // make sure we're incrementing

        // if ($this->currentStep > 1) {
        //     $this->currentStep = 1;
        // }

        // and checking whether we're complete
        if ($this->currentStep >= $this->totalSteps) {
            $this->isComplete = true;


Unexpectedly though, I have no issues running that job in my local environment after I add in a namespace…

How are you running the job? Via sake? Via the admin section in your browser? Via the dev/task in your browser? Or some other mechanism?
Did you flush when you added the new class and updated its namespace?
Do you have any other custom jobs?
Do you have any broken jobs in the queue? I have found sometimes that having broken jobs in the queue can make running the queue via sake fail unexpectedly so if you do, try removing the broken jobs and trying again.

Thanks for your reply.

Via the admin section


Yes, I was creating my first custom job when I discovered the error (same error), so I went back to basics and tried the dummy job without changing anything other than the namespace to try and troubleshoot. The dummy job wouldn’t run either so I have abandoned the other custom job for now. I also have wilr/silverstripe-algolia jobs that are running with no issues.

They don’t say they’re broken in the status but I’m unsure what a broken one looks like :slight_smile: I deleted everything in the QueuedJobDescriptor table just in case. The one that comes up with an error doesn’t seem to block other ones. In this image you can see my copy of the dummy job just sitting there doing nothing while the Symbiote\QueuedJobs\Tasks\DummyQueuedJob worked fine before it and the Algolia reindex worked fine after it.

I feel like it must be something really simple in some configuration somewhere that I have missed because I haven’t created my own job before but I’m confused by why the other jobs are running without any problems :thinking:

I’m sorry I can’t be any help, but I have no idea what might be causing this. I can’t reproduce the problem and there’s nothing obvious that you’re doing wrong or which might be interfering.