DOCX preview shows unable to load preview for externally validated OOXML file on Windows
Bug Description
Codex Desktop on Windows fails to preview a valid .docx file and shows the in-app message:
无法加载此预览
The same file was validated as a normal DOCX/OOXML package from the shell:
zipfile.testzip()returnedNoneword/document.xmlparses successfully with Pythonxml.etree.ElementTree[Content_Types].xmlis presentword/media/*image file hashes were preserved after text-only OOXML edits- The file is approximately 2.65 MB and contains 7 image files
This looks like a Codex Desktop document previewer failure, not a corrupt DOCX package.
Related issues I found before filing:
- #25007: DOCX preview is inconsistent across file tabs, file cards, and local links on Windows
- #25587: DOCX preview can show stale content after regenerating the same file path
This issue is slightly different: after validating and repairing the DOCX package so that XML parses cleanly, the preview still cannot load and displays 无法加载此预览.
Environment
- Agent Platform: Codex Desktop / Codex CLI
- Codex CLI Version:
codex-cli 0.136.0 - OS: Windows 11 Pro, version
10.0.22621, 64-bit - Shell: PowerShell
- File type:
.docx - Path characteristics: Windows absolute path, OneDrive-backed workspace, spaces and non-ASCII Chinese characters in directories and filename
What Happened
- A DOCX report was generated and opened in Codex Desktop.
- The user added images manually into the DOCX and asked the agent to make only text-level wording changes without touching images.
- The agent performed OOXML-level edits to
word/document.xmlonly. - During the first attempt, a bad global text replacement accidentally damaged XML syntax, which made preview failure understandable.
- The agent then repaired the DOCX package:
- restored XML closing tags and self-closing tags;
- restored namespace URLs;
- verified
word/document.xmlparses successfully; - verified the ZIP package with
zipfile.testzip(); - verified media file hashes were preserved.
- Even after those validations passed, Codex Desktop still showed the right-side preview error:
无法加载此预览
Expected Behavior
If a .docx package is structurally valid and word/document.xml parses successfully, Codex Desktop should either:
- render the document preview, or
- show a more specific diagnostic explaining why the previewer rejected it.
For document-generation workflows, a generic “unable to load preview” message leaves the user and agent unable to distinguish between:
- corrupted OOXML,
- unsupported document features,
- path/filename encoding problems,
- stale preview cache,
- file lock/OneDrive sync issues,
- previewer implementation errors.
Steps to Reproduce
- On Windows 11, create or use a
.docxfile in a OneDrive-backed workspace path with Chinese characters and spaces. - Include several images in the DOCX.
- Make a text-only OOXML edit to
word/document.xmland repackage the DOCX. - Validate the result externally:
```python
import zipfile, xml.etree.ElementTree as ET
with zipfile.ZipFile(path) as z:
assert z.testzip() is None
ET.fromstring(z.read("word/document.xml"))
```
- Open the DOCX from Codex Desktop's document/file preview UI.
- Observe that the preview panel can show
无法加载此预览even though the DOCX package validates.
Validation Details From This Case
The local validation output for the affected file was:
zip_bad None
xml_ok True
plus 0
slash 0
bad_markers False False False
media_equal True
media_files 7
size 2654682
A separate SHA-256 hash was also recorded locally for the file, but I am not including the document or path contents here because the DOCX belongs to a private customer workflow.
Impact
This is disruptive for DOCX-heavy workflows in Codex Desktop. Users often rely on the built-in preview to confirm document edits. When preview fails even after the file validates externally, the user cannot tell whether the document is actually broken or only the Codex previewer failed.
Suggested Improvements
- Add a preview reload / cache-bypass action for DOCX previews.
- Surface the underlying previewer error, such as XML parse error, unsupported relationship, failed conversion, file lock, path decode problem, etc.
- If the previewer rejects a valid DOCX, include enough diagnostics to determine whether the issue is file structure, path handling, cache, or renderer failure.