Upon email sending laravel.log error

I have one company in a database that everything is working fine with no errors.
However, on a second company in the same account it throws an error whenever sending emails, I can’t figure out why. Anyone have any ideas?

[2022-11-17 16:26:04] production.ERROR: Trying to access array offset on value of type null {"exception":"[object] (ErrorException(code: 0): Trying to access array offset on value of type null at /home/location/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:315)
[stacktrace]
#0 /home/location/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(259): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(315): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(327): Illuminate\\Queue\\Jobs\\Job->getName()
#3 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(227): Illuminate\\Queue\\Jobs\\Job->resolveName()
#4 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(196): Illuminate\\Queue\\Console\\WorkCommand->writeOutput()
#5 /home/location/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(421): Illuminate\\Queue\\Console\\WorkCommand->Illuminate\\Queue\\Console\\{closure}()
#6 /home/location/vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(249): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}()
#7 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(195): Illuminate\\Events\\Dispatcher->dispatch()
#8 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(582): Illuminate\\Queue\\Jobs\\Job->fail()
#9 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(528): Illuminate\\Queue\\Worker->failJob()
#10 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(452): Illuminate\\Queue\\Worker->markJobAsFailedIfWillExceedMaxAttempts()
#11 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(429): Illuminate\\Queue\\Worker->handleJobException()
#12 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(375): Illuminate\\Queue\\Worker->process()
#13 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(173): Illuminate\\Queue\\Worker->runJob()
#14 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(150): Illuminate\\Queue\\Worker->daemon()
#15 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(134): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#16 /home/location/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#17 /home/location/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#18 /home/location/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#19 /home/location/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#20 /home/location/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\\Container\\BoundMethod::call()
#21 /home/location/vendor/laravel/framework/src/Illuminate/Console/Command.php(178): Illuminate\\Container\\Container->call()
#22 /home/location/vendor/symfony/console/Command/Command.php(308): Illuminate\\Console\\Command->execute()
#23 /home/location/vendor/laravel/framework/src/Illuminate/Console/Command.php(148): Symfony\\Component\\Console\\Command\\Command->run()
#24 /home/location/vendor/symfony/console/Application.php(1014): Illuminate\\Console\\Command->run()
#25 /home/location/vendor/symfony/console/Application.php(301): Symfony\\Component\\Console\\Application->doRunCommand()
#26 /home/location/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
#27 /home/location/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\\Component\\Console\\Application->run()
#28 /home/location/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\\Console\\Application->run()
#29 /home/location/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#30 {main}

[previous exception] [object] (ErrorException(code: 0): Trying to access array offset on value of type null at /home/location/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php:210)
[stacktrace]
#0 /home/location/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(259): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError()
#1 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(210): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}()
#2 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(192): Illuminate\\Queue\\Jobs\\Job->failed()
#3 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(582): Illuminate\\Queue\\Jobs\\Job->fail()
#4 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(528): Illuminate\\Queue\\Worker->failJob()
#5 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(452): Illuminate\\Queue\\Worker->markJobAsFailedIfWillExceedMaxAttempts()
#6 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(429): Illuminate\\Queue\\Worker->handleJobException()
#7 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(375): Illuminate\\Queue\\Worker->process()
#8 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(173): Illuminate\\Queue\\Worker->runJob()
#9 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(150): Illuminate\\Queue\\Worker->daemon()
#10 /home/location/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(134): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#11 /home/location/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Queue\\Console\\WorkCommand->handle()
#12 /home/location/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#13 /home/location/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure()
#14 /home/location/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\\Container\\BoundMethod::callBoundMethod()
#15 /home/location/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\\Container\\BoundMethod::call()
#16 /home/location/vendor/laravel/framework/src/Illuminate/Console/Command.php(178): Illuminate\\Container\\Container->call()
#17 /home/location/vendor/symfony/console/Command/Command.php(308): Illuminate\\Console\\Command->execute()
#18 /home/location/vendor/laravel/framework/src/Illuminate/Console/Command.php(148): Symfony\\Component\\Console\\Command\\Command->run()
#19 /home/location/vendor/symfony/console/Application.php(1014): Illuminate\\Console\\Command->run()
#20 /home/location/vendor/symfony/console/Application.php(301): Symfony\\Component\\Console\\Application->doRunCommand()
#21 /home/location/vendor/symfony/console/Application.php(171): Symfony\\Component\\Console\\Application->doRun()
#22 /home/location/vendor/laravel/framework/src/Illuminate/Console/Application.php(102): Symfony\\Component\\Console\\Application->run()
#23 /home/location/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(155): Illuminate\\Console\\Application->run()
#24 /home/location/artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#25 {main}
"}

Hi,

@david any thoughts?

It looks like something is failing inside the job itself here, there are a couple of options to try and get the actual error to appear.

  1. inspect the failed_jobs table in the database, there may be more specific information, the job name will be NinjaMailerJob.

  2. change QUEUE_CONNECTION=sync

when the app is running in sync, the actual exception we are hitting will be displayed.

So, there were no jobs in failed_jobs.

I changed the variable QUEUE_CONNECTION=sync and it was not throwing any errors.
Then, I changed the variable back to database and now there are no new errors.

Is it possible that just changing it back and forth fixed something?

@techwiz

So the app is now working for you?

It sounds like just clearing the cache has fixed this for you?

Yes, it all seems to be working with no errors now. Thanks!