slimphp/Slim · error · RuntimeException

%s could not instantiate a decorated server request.

Error message

%s could not instantiate a decorated server request.

What it means

Error "%s could not instantiate a decorated server request." thrown in slimphp/Slim.

Source

Thrown at Slim/Factory/Psr17/SlimHttpServerRequestCreator.php:46

    }

    /**
     * {@inheritdoc}
     */
    public function createServerRequestFromGlobals(): ServerRequestInterface
    {
        if (!static::isServerRequestDecoratorAvailable()) {
            throw new RuntimeException('The Slim-Http ServerRequest decorator is not available.');
        }

        $request = $this->serverRequestCreator->createServerRequestFromGlobals();

        if (
            !((
                $decoratedServerRequest = new static::$serverRequestDecoratorClass($request)
                ) instanceof ServerRequestInterface)
        ) {
            throw new RuntimeException(get_called_class() . ' could not instantiate a decorated server request.');
        }

        return $decoratedServerRequest;
    }

    public static function isServerRequestDecoratorAvailable(): bool
    {
        return class_exists(static::$serverRequestDecoratorClass);
    }
}

View on GitHub (pinned to 80900fb39c)

When it happens

Trigger: Thrown at Slim/Factory/Psr17/SlimHttpServerRequestCreator.php:46 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slimphp/Slim@80900fb39c (2026-08-21). Data as JSON: /api/errors/b2e7b656585fabf6. Report an issue: GitHub.