Seldaek/monolog · error · InvalidArgumentException
SqsHandler accepts only formatted records as a string
Error message
SqsHandler accepts only formatted records as a string
What it means
Error "SqsHandler accepts only formatted records as a string" thrown in Seldaek/monolog.
Source
Thrown at src/Monolog/Handler/SqsHandler.php:48
private SqsClient $client;
private string $queueUrl;
public function __construct(SqsClient $sqsClient, string $queueUrl, int|string|Level $level = Level::Debug, bool $bubble = true)
{
parent::__construct($level, $bubble);
$this->client = $sqsClient;
$this->queueUrl = $queueUrl;
}
/**
* @inheritDoc
*/
protected function write(LogRecord $record): void
{
if (!isset($record->formatted) || 'string' !== \gettype($record->formatted)) {
throw new \InvalidArgumentException('SqsHandler accepts only formatted records as a string' . Utils::getRecordMessageForException($record));
}
$messageBody = $record->formatted;
if (\strlen($messageBody) >= static::MAX_MESSAGE_SIZE) {
$messageBody = Utils::substr($messageBody, 0, static::HEAD_MESSAGE_SIZE);
}
$this->client->sendMessage([
'QueueUrl' => $this->queueUrl,
'MessageBody' => $messageBody,
]);
}
}
View on GitHub (pinned to 57eb102834)
When it happens
Trigger: Thrown at src/Monolog/Handler/SqsHandler.php:48 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/08a256295b7fbf68.
Report an issue: GitHub.