slimphp/Slim · error · InvalidArgumentException
Invalid style `{$style}`. Must be `append` or `prepend`
Error message
Invalid style `{$style}`. Must be `append` or `prepend` What it means
Error "Invalid style `{$style}`. Must be `append` or `prepend`" thrown in slimphp/Slim.
Source
Thrown at Slim/Middleware/OutputBufferingMiddleware.php:45
class OutputBufferingMiddleware implements MiddlewareInterface
{
public const APPEND = 'append';
public const PREPEND = 'prepend';
protected StreamFactoryInterface $streamFactory;
protected string $style;
/**
* @param string $style Either "append" or "prepend"
*/
public function __construct(StreamFactoryInterface $streamFactory, string $style = 'append')
{
$this->streamFactory = $streamFactory;
$this->style = $style;
if (!in_array($style, [static::APPEND, static::PREPEND], true)) {
throw new InvalidArgumentException("Invalid style `{$style}`. Must be `append` or `prepend`");
}
}
/**
* @throws Throwable
*/
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
try {
ob_start();
$response = $handler->handle($request);
$output = ob_get_clean();
} catch (Throwable $e) {
ob_end_clean();
throw $e;
}
if (!empty($output)) {View on GitHub (pinned to 80900fb39c)
When it happens
Trigger: Thrown at Slim/Middleware/OutputBufferingMiddleware.php:45 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/18a39d51ce061e57.
Report an issue: GitHub.