Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Franzis7's avatar

[Laravel 8] php artisan queue:retry all -> RuntimeException

Hello,

i have a problem when i run the command php artisan queue:retry all

I get the following error:

 RuntimeException 

  Session store not set on request.

  at vendor/laravel/framework/src/Illuminate/Http/Request.php:483
    479▕      */
    480▕     public function session()
    481▕     {
    482▕         if (! $this->hasSession()) {
  ➜ 483▕             throw new RuntimeException('Session store not set on request.');
    484▕         }
    485▕ 
    486▕         return $this->session;
    487▕     }

      +21 vendor frames 
  22  [internal]:0
      App\Event\Salesforce\AccountEvent::__unserialize()

      +16 vendor frames 
  39  artisan:37
      Illuminate\Foundation\Console\Kernel::handle()

I store my session into database .env => SESSION_DRIVER=database

0 likes
11 replies
Snapey's avatar

Queued jobs do not have access to session.

You should find the code in your job which is trying to use session, and refactor it so that the data it needs is passed into the job when it is dispatched.

1 like
Franzis7's avatar

This is the Log of failed job:


[] local.ERROR: Session store not set on request. {"exception":"[object] (RuntimeException(code: 0): Session store not set on request. at /var/www/html/vendor/laravel/framework/src/Illuminate/Http/Request.php:483)
[stacktrace]
#0 /var/www/html/vendor/omniphx/forrest/src/Omniphx/Forrest/Providers/Laravel/ForrestServiceProvider.php(38): Illuminate\Http\Request->session()
#1 /var/www/html/vendor/omniphx/forrest/src/Omniphx/Forrest/Providers/BaseServiceProvider.php(93): Omniphx\Forrest\Providers\Laravel\ForrestServiceProvider->getStorage()
#2 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(869): Omniphx\Forrest\Providers\BaseServiceProvider->Omniphx\Forrest\Providers\{closure}()
#3 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(754): Illuminate\Container\Container->build()
#4 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(841): Illuminate\Container\Container->resolve()
#5 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(692): Illuminate\Foundation\Application->resolve()
#6 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(826): Illuminate\Container\Container->make()
#7 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(1418): Illuminate\Foundation\Application->make()
#8 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(198): Illuminate\Container\Container->offsetGet()
#9 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(166): Illuminate\Support\Facades\Facade::resolveFacadeInstance()
#10 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(255): Illuminate\Support\Facades\Facade::getFacadeRoot()
#11 /var/www/html/vendor/rob-lester-jr04/eloquent-sales-force/src/SObjects.php(55): Illuminate\Support\Facades\Facade::__callStatic()
#12 /var/www/html/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(261): Lester\EloquentSalesForce\SObjects->authenticate()
#13 /var/www/html/vendor/rob-lester-jr04/eloquent-sales-force/src/Model.php(135): Illuminate\Support\Facades\Facade::__callStatic()
#14 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1260): Lester\EloquentSalesForce\Model->newEloquentBuilder()
#15 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1296): Illuminate\Database\Eloquent\Model->newModelQuery()
#16 /var/www/html/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php(1322): Illuminate\Database\Eloquent\Model->newQueryWithoutScopes()
#17 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(114): Illuminate\Database\Eloquent\Model->newQueryForRestoration()
#18 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(101): App\Event\Salesforce\AccountEvent->getQueryForModelRestoration()
#19 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/SerializesAndRestoresModelIdentifiers.php(57): App\Event\Salesforce\AccountEvent->restoreModel()
#20 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/SerializesModels.php(122): App\Event\Salesforce\AccountEvent->getRestoredPropertyValue()
#21 [internal function]: App\Event\Salesforce\AccountEvent->__unserialize()
#22 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(97): unserialize()
#23 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(253): Illuminate\Queue\CallQueuedHandler->getCommand()
#24 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(213): Illuminate\Queue\CallQueuedHandler->failed()
#25 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(192): Illuminate\Queue\Jobs\Job->failed()
#26 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(581): Illuminate\Queue\Jobs\Job->fail()
#27 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(527): Illuminate\Queue\Worker->failJob()
#28 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(455): Illuminate\Queue\Worker->markJobAsFailedIfWillExceedMaxAttempts()
#29 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(432): Illuminate\Queue\Worker->handleJobException()
#30 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()
#31 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(172): Illuminate\Queue\Worker->runJob()
#32 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->daemon()
#33 /var/www/html/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker()
#34 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#35 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#36 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#37 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#38 /var/www/html/vendor/laravel/framework/src/Illuminate/Container/Container.php(651): Illuminate\Container\BoundMethod::call()
#39 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#40 /var/www/html/vendor/symfony/console/Command/Command.php(299): Illuminate\Console\Command->execute()
#41 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#42 /var/www/html/vendor/symfony/console/Application.php(978): Illuminate\Console\Command->run()
#43 /var/www/html/vendor/symfony/console/Application.php(295): Symfony\Component\Console\Application->doRunCommand()
#44 /var/www/html/vendor/symfony/console/Application.php(167): Symfony\Component\Console\Application->doRun()
#45 /var/www/html/vendor/laravel/framework/src/Illuminate/Console/Application.php(92): Symfony\Component\Console\Application->run()
#46 /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#47 /var/www/html/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#48 {main}
"} 
bugsysha's avatar

It shows you everything. Focus on these two.

/var/www/html/vendor/omniphx/forrest/src/Omniphx/Forrest/Providers/Laravel/ForrestServiceProvider.php(38): Illuminate\Http\Request->session()

/var/www/html/vendor/omniphx/forrest/src/Omniphx/Forrest/Providers/BaseServiceProvider.php(93): Omniphx\Forrest\Providers\Laravel\ForrestServiceProvider->getStorage()
Franzis7's avatar

Thanks @bugsysha,

now I focus on these lines.

I'm in that bubble of the programmer who after so many hours of code, in which I can't see even the most obvious errors.

bugsysha's avatar

I'm in that bubble of the programmer who after so many hours of code, in which I can't see even the most obvious errors.

@franzis7 know that you are not alone. A bunch of developers falls into the same trap. But reading and understanding the stack trace from a log file is something you should be always capable to figure out.

1 like
Franzis7's avatar
Franzis7
OP
Best Answer
Level 1

Thanks @snapey and @bugsysha with your support.

In the end I solved it by setting in the file eloquent_sf.php

'storage' => [
      'type' => 'cache', instead of session
1 like
Snapey's avatar

I assume you published the config file and changed it there?

Please or to participate in this conversation.