Seldaek/monolog · error · RuntimeException
Failed to run preg_replace: ${code} / ${message}
Error message
Failed to run preg_replace: ${code} / ${message} What it means
Error "Failed to run preg_replace: ${code} / ${message}" thrown in Seldaek/monolog.
Source
Thrown at src/Monolog/Formatter/LineFormatter.php:178
if (\count($vars['extra']) === 0) {
unset($vars['extra']);
$output = str_replace('%extra%', '', $output);
}
}
foreach ($vars as $var => $val) {
if (false !== strpos($output, '%'.$var.'%')) {
$output = str_replace('%'.$var.'%', $this->stringify($val), $output);
}
}
// remove leftover %extra.xxx% and %context.xxx% if any
if (false !== strpos($output, '%')) {
$output = preg_replace('/%(?:extra|context)\..+?%/', '', $output);
if (null === $output) {
$pcreErrorCode = preg_last_error();
throw new \RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . preg_last_error_msg());
}
}
return $output;
}
public function formatBatch(array $records): string
{
$message = '';
foreach ($records as $record) {
$message .= $this->format($record);
}
return $message;
}
/**
* @param mixed $valueView on GitHub (pinned to 57eb102834)
When it happens
Trigger: Thrown at src/Monolog/Formatter/LineFormatter.php:178 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/211d4adb8cb4e1ca.
Report an issue: GitHub.