{"record":{"id":"f8a3b39863275451","repo":"Seldaek/monolog","slug":"telegram-api-error-description-description","errorCode":null,"errorMessage":"Telegram API error. Description: ${description}","messagePattern":"Telegram API error\\. Description: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/TelegramBotHandler.php","lineNumber":320,"sourceCode":"    }\n\n    /**\n     * @param  string|bool      $rawResult Raw response body from the Telegram API call\n     * @throws RuntimeException When the response is missing, non-JSON, or signals failure\n     */\n    protected function validateApiResponse(string|bool $rawResult): void\n    {\n        if (!\\is_string($rawResult)) {\n            throw new RuntimeException('Telegram API error. Description: No response');\n        }\n\n        $result = json_decode($rawResult, true);\n\n        if (!\\is_array($result)) {\n            throw new RuntimeException('Telegram API error. Description: Unexpected non-JSON response');\n        }\n        if (($result['ok'] ?? null) !== true) {\n            throw new RuntimeException('Telegram API error. Description: ' . ($result['description'] ?? 'Unknown error'));\n        }\n    }\n\n    /**\n     * Handle a message that is too long: truncates or splits into several\n     * @return string[]\n     */\n    private function handleMessageLength(string $message): array\n    {\n        $truncatedMarker = ' (…truncated)';\n        if (!$this->splitLongMessages && \\strlen($message) > self::MAX_MESSAGE_LENGTH) {\n            return [Utils::substr($message, 0, self::MAX_MESSAGE_LENGTH - \\strlen($truncatedMarker)) . $truncatedMarker];\n        }\n\n        return str_split($message, self::MAX_MESSAGE_LENGTH);\n    }\n}\n","sourceCodeStart":302,"sourceCodeEnd":338,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/TelegramBotHandler.php#L302-L338","documentation":"Error \"Telegram API error. Description: ${description}\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/TelegramBotHandler.php:320 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"}