{"record":{"id":"3ed87b822f7e06bb","repo":"Seldaek/monolog","slug":"you-tried-to-pop-from-an-empty-handler-stack","errorCode":null,"errorMessage":"You tried to pop from an empty handler stack.","messagePattern":"You tried to pop from an empty handler stack\\.","errorType":"exception","errorClass":"LogicException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Logger.php","lineNumber":222,"sourceCode":"     *\n     * @return $this\n     */\n    public function pushHandler(HandlerInterface $handler): self\n    {\n        array_unshift($this->handlers, $handler);\n\n        return $this;\n    }\n\n    /**\n     * Pops a handler from the stack\n     *\n     * @throws \\LogicException If empty handler stack\n     */\n    public function popHandler(): HandlerInterface\n    {\n        if (0 === \\count($this->handlers)) {\n            throw new \\LogicException('You tried to pop from an empty handler stack.');\n        }\n\n        return array_shift($this->handlers);\n    }\n\n    /**\n     * Set handlers, replacing all existing ones.\n     *\n     * If a map is passed, keys will be ignored.\n     *\n     * @param  list<HandlerInterface> $handlers\n     * @return $this\n     */\n    public function setHandlers(array $handlers): self\n    {\n        $this->handlers = [];\n        foreach (array_reverse($handlers) as $handler) {\n            $this->pushHandler($handler);","sourceCodeStart":204,"sourceCodeEnd":240,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Logger.php#L204-L240","documentation":"Error \"You tried to pop from an empty handler stack.\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Logger.php:222 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}