slimphp/Slim · error · RuntimeException

%s could not instantiate a response factory.

Error message

%s could not instantiate a response factory.

What it means

Error "%s could not instantiate a response factory." thrown in slimphp/Slim.

Source

Thrown at Slim/Factory/Psr17/Psr17Factory.php:41

{
    protected static string $responseFactoryClass;

    protected static string $streamFactoryClass;

    protected static string $serverRequestCreatorClass;

    protected static string $serverRequestCreatorMethod;

    /**
     * {@inheritdoc}
     */
    public static function getResponseFactory(): ResponseFactoryInterface
    {
        if (
            !static::isResponseFactoryAvailable()
            || !(($responseFactory = new static::$responseFactoryClass()) instanceof ResponseFactoryInterface)
        ) {
            throw new RuntimeException(get_called_class() . ' could not instantiate a response factory.');
        }

        return $responseFactory;
    }

    /**
     * {@inheritdoc}
     */
    public static function getStreamFactory(): StreamFactoryInterface
    {
        if (
            !static::isStreamFactoryAvailable()
            || !(($streamFactory = new static::$streamFactoryClass()) instanceof StreamFactoryInterface)
        ) {
            throw new RuntimeException(get_called_class() . ' could not instantiate a stream factory.');
        }

        return $streamFactory;

View on GitHub (pinned to 80900fb39c)

When it happens

Trigger: Thrown at Slim/Factory/Psr17/Psr17Factory.php:41 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/76f255d7c7c1b074. Report an issue: GitHub.