Seldaek/monolog · error · LogicException

You tried to pop from an empty handler stack.

Error message

You tried to pop from an empty handler stack.

What it means

Error "You tried to pop from an empty handler stack." thrown in Seldaek/monolog.

Source

Thrown at src/Monolog/Logger.php:222

     *
     * @return $this
     */
    public function pushHandler(HandlerInterface $handler): self
    {
        array_unshift($this->handlers, $handler);

        return $this;
    }

    /**
     * Pops a handler from the stack
     *
     * @throws \LogicException If empty handler stack
     */
    public function popHandler(): HandlerInterface
    {
        if (0 === \count($this->handlers)) {
            throw new \LogicException('You tried to pop from an empty handler stack.');
        }

        return array_shift($this->handlers);
    }

    /**
     * Set handlers, replacing all existing ones.
     *
     * If a map is passed, keys will be ignored.
     *
     * @param  list<HandlerInterface> $handlers
     * @return $this
     */
    public function setHandlers(array $handlers): self
    {
        $this->handlers = [];
        foreach (array_reverse($handlers) as $handler) {
            $this->pushHandler($handler);

View on GitHub (pinned to 57eb102834)

When it happens

Trigger: Thrown at src/Monolog/Logger.php:222 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Seldaek/monolog@57eb102834 (2026-08-17). Data as JSON: /api/errors/3ed87b822f7e06bb. Report an issue: GitHub.