{"record":{"id":"c89f797b2b10c4ed","repo":"PHPOffice/PHPWord","slug":"the-part-s-doesn-t-exist","errorCode":null,"errorMessage":"The part \"%s\" doesn't exist","messagePattern":"The part \"(.+?)\" doesn't exist","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/PhpWord/Reader/Word2007.php","lineNumber":108,"sourceCode":"                    $part = $this->readPart($phpWord, $relationships, $commentRefs, $partName, $docFile, $xmlFile);\n                    $commentRefs = $part->getCommentReferences();\n                }\n            }\n        }\n\n        return $phpWord;\n    }\n\n    /**\n     * Read document part.\n     *\n     * @param array<string, array<string, null|AbstractElement>> $commentRefs\n     */\n    private function readPart(PhpWord $phpWord, array $relationships, array $commentRefs, string $partName, string $docFile, string $xmlFile): AbstractPart\n    {\n        $partClass = \"PhpOffice\\\\PhpWord\\\\Reader\\\\Word2007\\\\{$partName}\";\n        if (!class_exists($partClass)) {\n            throw new Exception(sprintf('The part \"%s\" doesn\\'t exist', $partClass));\n        }\n\n        /** @var AbstractPart $part Type hint */\n        $part = new $partClass($docFile, $xmlFile);\n        $part->setImageLoading($this->hasImageLoading());\n        $part->setRels($relationships);\n        $part->setCommentReferences($commentRefs);\n        $part->read($phpWord);\n\n        return $part;\n    }\n\n    /**\n     * Read all relationship files.\n     *\n     * @param string $docFile\n     *\n     * @return array","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/PHPOffice/PHPWord/blob/aef95c04151b5633cc505f672ddd6a71da900ee1/src/PhpWord/Reader/Word2007.php#L90-L126","documentation":"Word2007's readPart maps an OOXML part name to a reader class PhpOffice\\PhpWord\\Reader\\Word2007\\{partName}. If that class does not exist, the document references a part the reader cannot handle, so it throws.","triggerScenarios":"Loading a .docx whose document.xml.rels references a part with no corresponding reader class (rare/unsupported part types, corrupted relationship data, or documents produced by non-Word generators with unusual part names).","commonSituations":"Third-party docx generators emitting custom parts; corrupted or hand-edited .docx packages; PhpWord version lacking a newly added part reader.","solutions":["Update PhpWord to the latest version for additional part support","Open the .docx (rename to .zip) and inspect word/_rels/document.xml.rels for unusual parts","Re-save the document in Microsoft Word or LibreOffice to normalize parts","Remove or ignore the offending custom part if it is not needed"],"exampleFix":"// before\n$phpWord = \\PhpOffice\\PhpWord\\IOFactory::load('thirdparty.docx'); // unsupported part\n// after\ntry {\n    $phpWord = \\PhpOffice\\PhpWord\\IOFactory::load('thirdparty.docx');\n} catch (\\Exception $e) {\n    // resave via LibreOffice to normalize parts\n    shell_exec('libreoffice --headless --convert-to docx thirdparty.docx');\n    $phpWord = \\PhpOffice\\PhpWord\\IOFactory::load('thirdparty_converted.docx');\n}","handlingStrategy":"try-catch","validationCode":"$zip = new \\ZipArchive(); if ($zip->open($docFile) === true) { $rels = $zip->getFromName('word/_rels/document.xml.rels'); $zip->close(); } // inspect for unusual part names","typeGuard":null,"tryCatchPattern":"try { $phpWord = \\PhpOffice\\PhpWord\\IOFactory::load($docFile); } catch (\\PhpOffice\\PhpWord\\Exception\\Exception $e) { if (str_contains($e->getMessage(), 'doesn\\'t exist')) { // resave doc in Word/LibreOffice to normalize } throw $e; }","preventionTips":["Keep PhpWord up to date for new part readers","Re-save third-party docx files in Word before processing","Reject documents with unknown relationship types at intake"],"tags":["phpword","word2007","docx","unsupported-part"],"backgroundTag":"class-not-found","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"}