{"record":{"id":"4bc2e4610b548bea","repo":"pestphp/pest","slug":"the-beforeall-hook-is-already-defined-in-s-e","errorCode":null,"errorMessage":"The [beforeAll] hook is already defined in [%s]. Each test file may only define it once.","messagePattern":"The \\[beforeAll\\] hook is already defined in \\[(.+?)\\]\\. Each test file may only define it once\\.","errorType":"exception","errorClass":"BeforeAllAlreadyExist","httpStatus":null,"severity":"error","filePath":"src/Repositories/BeforeAllRepository.php","lineNumber":36,"sourceCode":"     * @var array<string, Closure>\n     */\n    private array $state = [];\n\n    public function pop(string $filename): Closure\n    {\n        $closure = $this->get($filename);\n\n        unset($this->state[$filename]);\n\n        return $closure;\n    }\n\n    public function set(Closure $closure): void\n    {\n        $filename = Reflection::getFileNameFromClosure($closure);\n\n        if (array_key_exists($filename, $this->state)) {\n            throw new BeforeAllAlreadyExist($filename);\n        }\n\n        $this->state[$filename] = $closure;\n    }\n\n    public function get(string $filename): Closure\n    {\n        return $this->state[$filename] ?? NullClosure::create();\n    }\n}\n","sourceCodeStart":18,"sourceCodeEnd":47,"githubUrl":"https://github.com/pestphp/pest/blob/1af74a215c3a89bc7a44fc6f9322e369eaad2423/src/Repositories/BeforeAllRepository.php#L18-L47","documentation":"Error \"The [beforeAll] hook is already defined in [%s]. Each test file may only define it once.\" thrown in pestphp/pest.","triggerScenarios":"Thrown at src/Repositories/BeforeAllRepository.php:36 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":"1af74a215c3a89bc7a44fc6f9322e369eaad2423","analyzedAt":"2026-08-21T02:16:38.132Z","schemaVersion":2},"datasetVersion":"2026-08-21T03:17:12.404Z"}