{"record":{"id":"211d4adb8cb4e1ca","repo":"Seldaek/monolog","slug":"failed-to-run-preg-replace-code-message","errorCode":null,"errorMessage":"Failed to run preg_replace: ${code} / ${message}","messagePattern":"Failed to run preg_replace: (.+?) / (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Formatter/LineFormatter.php","lineNumber":178,"sourceCode":"            if (\\count($vars['extra']) === 0) {\n                unset($vars['extra']);\n                $output = str_replace('%extra%', '', $output);\n            }\n        }\n\n        foreach ($vars as $var => $val) {\n            if (false !== strpos($output, '%'.$var.'%')) {\n                $output = str_replace('%'.$var.'%', $this->stringify($val), $output);\n            }\n        }\n\n        // remove leftover %extra.xxx% and %context.xxx% if any\n        if (false !== strpos($output, '%')) {\n            $output = preg_replace('/%(?:extra|context)\\..+?%/', '', $output);\n            if (null === $output) {\n                $pcreErrorCode = preg_last_error();\n\n                throw new \\RuntimeException('Failed to run preg_replace: ' . $pcreErrorCode . ' / ' . preg_last_error_msg());\n            }\n        }\n\n        return $output;\n    }\n\n    public function formatBatch(array $records): string\n    {\n        $message = '';\n        foreach ($records as $record) {\n            $message .= $this->format($record);\n        }\n\n        return $message;\n    }\n\n    /**\n     * @param mixed $value","sourceCodeStart":160,"sourceCodeEnd":196,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Formatter/LineFormatter.php#L160-L196","documentation":"Error \"Failed to run preg_replace: ${code} / ${message}\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Formatter/LineFormatter.php:178 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"}