{"record":{"id":"2277da116ac59535","repo":"PHPOffice/PHPWord","slug":"writer-element-class-writerclass-not-found","errorCode":null,"errorMessage":"Writer element class {$writerClass} not found.","messagePattern":"Writer element class (.+?) not found\\.","errorType":"exception","errorClass":"PhpOffice\\PhpWord\\Exception\\Exception","httpStatus":null,"severity":"error","filePath":"src/PhpWord/Writer/EPub3/Element/AbstractElement.php","lineNumber":40,"sourceCode":"\n/**\n * Abstract element writer.\n *\n * @since 0.11.0\n */\nabstract class AbstractElement extends Word2007AbstractElement\n{\n    /**\n     * Get class name of writer element based on read element.\n     *\n     * @param \\PhpOffice\\PhpWord\\Element\\AbstractElement $element\n     */\n    public static function getElementClass($element): string\n    {\n        $elementClass = str_replace('PhpOffice\\\\PhpWord\\\\Element\\\\', '', get_class($element));\n        $writerClass = 'PhpOffice\\\\PhpWord\\\\Writer\\\\EPub3\\\\Element\\\\' . $elementClass;\n        if (!class_exists($writerClass)) {\n            throw new \\PhpOffice\\PhpWord\\Exception\\Exception(\"Writer element class {$writerClass} not found.\");\n        }\n\n        return $writerClass;\n    }\n}\n","sourceCodeStart":22,"sourceCodeEnd":46,"githubUrl":"https://github.com/PHPOffice/PHPWord/blob/aef95c04151b5633cc505f672ddd6a71da900ee1/src/PhpWord/Writer/EPub3/Element/AbstractElement.php#L22-L46","documentation":"Class-resolution guard: the EPub3 writer maps a PhpWord element class to a same-named writer element under Writer\\EPub3\\Element; class_exists() failed, so that element type has no EPub3 writer implementation. Indicates an unsupported element or a missing/wrongly named writer class.","triggerScenarios":"Thrown at src/PhpWord/Writer/EPub3/Element/AbstractElement.php:40 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Create or register a matching writer element class in PhpOffice\\PhpWord\\Writer\\EPub3\\Element for the unsupported element.","Catch the exception and skip or render the element with a default writer element instead."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"aef95c04151b5633cc505f672ddd6a71da900ee1","analyzedAt":"2026-09-14T10:53:58.933Z","contentChangedAt":"2026-09-14T10:53:58.933Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}