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

secondman's avatar

Route:list produces Session store not set on request error

Whenever I run route:list I get the following error:

[RuntimeException]
Session store not set on request.

I don't seem to get it anywhere else that I've found so far.

I'm running Laravel Framework version 5.2.41

Thanks.

0 likes
3 replies
InaniELHoussain's avatar

Route::group(['middleware' => ['web']], function () { // your routes here });

secondman's avatar
secondman
OP
Best Answer
Level 17

Found it.

I had a constructor that was asking for a $request->session() and of course running under the console there is no session.

Changed to :

public function __construct(Request $request)
{
    $this->request = $request;
    
    if ($request->ajax()) {
        $this->session = $request->session();
    }
}

And now the error is gone, hopefully someone will find this useful.

1 like
maxss's avatar

Use if ($request->hasSession()) { ... } to check if the request has a session.

Please or to participate in this conversation.