Session library with flash message support for Slim 4

Thats strange. Are your sure the SessionMiddleware get handled by the dispatcher?

Check the source. When the SessionMiddleware starts, the session will be started:

There is no if/else statement which should prevent the middleware to start the session. Except the “session already started”-Exception.