{"record":{"id":"39a51cf9592010d8","repo":"Seldaek/monolog","slug":"elasticsearchhandler-is-only-compatible-with-elast","errorCode":null,"errorMessage":"ElasticsearchHandler is only compatible with ElasticsearchFormatter","messagePattern":"ElasticsearchHandler is only compatible with ElasticsearchFormatter","errorType":"exception","errorClass":"InvalidArgumentException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/ElasticsearchHandler.php","lineNumber":121,"sourceCode":"\n    /**\n     * @inheritDoc\n     */\n    protected function write(LogRecord $record): void\n    {\n        $this->bulkSend([$record->formatted]);\n    }\n\n    /**\n     * @inheritDoc\n     */\n    public function setFormatter(FormatterInterface $formatter): HandlerInterface\n    {\n        if ($formatter instanceof ElasticsearchFormatter) {\n            return parent::setFormatter($formatter);\n        }\n\n        throw new InvalidArgumentException('ElasticsearchHandler is only compatible with ElasticsearchFormatter');\n    }\n\n    /**\n     * Getter options\n     *\n     * @return mixed[]\n     *\n     * @phpstan-return Options\n     */\n    public function getOptions(): array\n    {\n        return $this->options;\n    }\n\n    /**\n     * @inheritDoc\n     */\n    protected function getDefaultFormatter(): FormatterInterface","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/ElasticsearchHandler.php#L103-L139","documentation":"Error \"ElasticsearchHandler is only compatible with ElasticsearchFormatter\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/ElasticsearchHandler.php:121 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"}