{"record":{"id":"40598dc65982f6d2","repo":"pestphp/pest","slug":"the-afterall-hook-is-already-defined-in-s-ea","errorCode":null,"errorMessage":"The [afterAll] hook is already defined in [%s]. Each test file may only define it once.","messagePattern":"The \\[afterAll\\] hook is already defined in \\[(.+?)\\]\\. Each test file may only define it once\\.","errorType":"exception","errorClass":"AfterAllAlreadyExist","httpStatus":null,"severity":"error","filePath":"src/Repositories/AfterAllRepository.php","lineNumber":34,"sourceCode":"{\n    /**\n     * @var array<string, Closure>\n     */\n    private array $state = [];\n\n    public function each(callable $each): void\n    {\n        foreach ($this->state as $filename => $closure) {\n            $each($filename, $closure);\n        }\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 AfterAllAlreadyExist($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":16,"sourceCodeEnd":45,"githubUrl":"https://github.com/pestphp/pest/blob/1af74a215c3a89bc7a44fc6f9322e369eaad2423/src/Repositories/AfterAllRepository.php#L16-L45","documentation":"Error \"The [afterAll] hook is already defined in [%s]. Each test file may only define it once.\" thrown in pestphp/pest.","triggerScenarios":"Thrown at src/Repositories/AfterAllRepository.php:34 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"}