slimphp/Slim · error · RuntimeException

No parser for type %s

Error message

No parser for type %s

What it means

Error "No parser for type %s" thrown in slimphp/Slim.

Source

Thrown at Slim/Middleware/BodyParsingMiddleware.php:92

        return $this;
    }

    /**
     * @param string $mediaType A HTTP media type (excluding content-type params).
     */
    public function hasBodyParser(string $mediaType): bool
    {
        return isset($this->bodyParsers[$mediaType]);
    }

    /**
     * @param string $mediaType A HTTP media type (excluding content-type params).
     * @throws RuntimeException
     */
    public function getBodyParser(string $mediaType): callable
    {
        if (!isset($this->bodyParsers[$mediaType])) {
            throw new RuntimeException('No parser for type ' . $mediaType);
        }
        return $this->bodyParsers[$mediaType];
    }

    protected function registerDefaultBodyParsers(): void
    {
        $this->registerBodyParser('application/json', static function ($input) {
            /** @var string $input */
            $result = json_decode($input, true);

            if (!is_array($result)) {
                return null;
            }

            return $result;
        });

        $this->registerBodyParser('application/x-www-form-urlencoded', static function ($input) {

View on GitHub (pinned to 80900fb39c)

When it happens

Trigger: Thrown at Slim/Middleware/BodyParsingMiddleware.php:92 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/6fe73d204a44dca9. Report an issue: GitHub.