symfony/http-kernel · error · InvalidArgumentException

The " " renderer does not exist.

Error message

The "%s" renderer does not exist.

What it means

FragmentHandler::render() throws InvalidArgumentException when the requested renderer name is not registered in the handler's renderers map. The renderer registry is keyed by strategy name (e.g. 'esi', 'ssi', 'inline'), so an unknown key means the strategy was never registered in the constructor.

Solutions

  1. Register the renderer: pass it to new FragmentHandler($urlGenerator, [$rendererName => $renderer, ...], $requestStack).
  2. Verify the renderer name key matches the string passed as $renderer to render().
  3. Check that the Symfony HttpKernel Fragment bundle config enables the strategy you are calling.

Example fix

// before
$handler = new FragmentHandler($requestStack);
$handler->render('/_fragment/foo', 'esi');
// after
$handler = new FragmentHandler($requestStack, ['esi' => new EsiRenderer($uriSigner)]);
$handler->render('/_fragment/foo', 'esi');
Defensive patterns

Strategy: validation

Validate before calling

if (!in_array($renderer, ['inline', 'esi', 'ssi'], true)) { throw new \InvalidArgumentException("Unknown renderer: $renderer"); }

Type guard

function isValidRenderer(string $r): bool { return isset($renderers[$r]); }

Prevention

When it happens

Trigger: Calling $handler->render($uri, 'esi') when no EsiRenderer was passed to FragmentHandler's constructor, or a typo in the renderer name ('inline' vs 'insline').

Common situations: Misconfigured fragment rendering setup, switching strategies without registering the matching renderer, or copying code that uses a strategy the app never installed.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of symfony/http-kernel@aa3a39d728 (2026-09-13). Data as JSON: /api/errors/5a197354e22ea6f4. Report an issue: GitHub.

Appendix: source

Thrown at Fragment/FragmentHandler.php:74

    /**
     * Renders a URI and returns the Response content.
     *
     * Available options:
     *
     *  * ignore_errors: true to return an empty string in case of an error
     *
     * @throws \InvalidArgumentException when the renderer does not exist
     * @throws \LogicException           when no main request is being handled
     */
    public function render(string|ControllerReference $uri, string $renderer = 'inline', array $options = []): ?string
    {
        if (!isset($options['ignore_errors'])) {
            $options['ignore_errors'] = !$this->debug;
        }

        if (!isset($this->renderers[$renderer])) {
            throw new \InvalidArgumentException(\sprintf('The "%s" renderer does not exist.', $renderer));
        }

        if (!$request = $this->requestStack->getCurrentRequest()) {
            throw new \LogicException('Rendering a fragment can only be done when handling a Request.');
        }

        return $this->deliver($this->renderers[$renderer]->render($uri, $request, $options));
    }

    /**
     * Delivers the Response as a string.
     *
     * When the Response is a StreamedResponse, the content is streamed immediately
     * instead of being returned.
     *
     * @return string|null The Response content or null when the Response is streamed
     *
     * @throws \RuntimeException when the Response is not successful

View on GitHub (pinned to aa3a39d728)