iOfficeAI / iOfficeAI/OfficeCLI
HTML renderer FormatException "Could not find any recognizable digits" on WPS-created slide; watch stuck at "Waiting for first update..." forever
- Dominant language
- C#
- Stars
- 30.7k
- Forks
- 2.1k
- Avg merge
- 9d 8h
- Merged PRs (30d)
- 5
Description
## Summary
On a WPS-created .pptx deck, the HTML renderer throws `FormatException: Could not find any recognizable digits` for one specific slide. Because the initial **full-deck render is all-or-nothing**, the whole render aborts, and `officecli watch` then serves the "Waiting for first update... Run an officecli command to see the preview" shell **forever** — even after subsequent officecli mutations, because:
1. every full re-render hits the same exception, and
2. the waiting shell does not recover from per-slide `replace` SSE events (after a mutation, the server pushes `{"action":"replace","slide":1,...}` with correct HTML for healthy slides, but a browser sitting on the waiting shell never transitions to the document view).
`officecli view html` (full deck) reproduces the failure standalone — no watch needed:
```
$ officecli view deck.pptx html
Error: Could not find any recognizable digits.
```
## Environment
- officecli 1.0.143 (single binary, ~/.local/bin), macOS 26 (Apple Silicon)
- Deck created by **WPS 演示 14.0000** (`extended.application=WPS 演示`), 22 slides, ~150 MB
## What I found (bisecting the deck)
- `officecli view deck.pptx html --start N --end N` renders every slide fine **except slide 21**, which fails with the FormatException. Slide 21 uses layout `发展潜力` (objType); no other slide uses that layout.
- The trigger is **not** a single element: removing any *one* of slide 21's top-level elements still fails. Removing a specific set of **18 elements together** (three "card" composites of nested groups + rounded rects + textboxes, plus three rotated custom-geometry freeform decorations) makes slide 21 render. So the failing parse involves an interaction/aggregation across multiple elements, not one malformed attribute.
- Ruled out by inspection: no empty/whitespace/non-numeric values in any numeric attribute of slide21.xml (`x/y/cx/cy/rot/sz/pos/val/...` all clean), no `p:transition`/`p:timing`/`mc:AlternateContent` on the slide or its layout, `dump /slide[21]` succeeds (379 KB batch JSON — so the property-parse pipeline is fine), and `view svg --start 21 --end 21` renders fine (SVG pipeline unaffected). Only the **HTML renderer** throws.
- The slide + layout are heavy on WPS-style custom geometry (`` with `` using `` guide-name references, and `` reversed-token formulas) — 4 custGeom on the slide, 28 on the layout. These are legal per OOXML (ST_GuideFormula), and PowerPoint/WPS open the deck fine. Possibly related, possibly not — the all-or-nothing bisect result suggests an aggregation phase rather than one shape.
- WPS also attaches `` (`KSO_WM_BEAUTIFY_FLAG`) to most shapes — likely irrelevant, mentioned for completeness.
## Repro file
I can produce an 8 MB single-slide .pptx (all other slides removed via `batch remove`) that still reproduces the failure with a bare `officecli view repro.pptx html`. It contains personal content from a user's presentation, so I'd rather not attach it publicly — happy to share it privately with maintainers (or help build a synthetic minimal repro if you can tell me which code path raises this FormatException; a stack-trace toggle like `--debug`/`--verbose` would also help).
## Suggested fixes (in priority order)
1. **Graceful degradation**: render slides independently; if one slide throws, emit an error placeholder for that slide and keep the rest — never let one bad slide blank the whole preview.
2. **Watch recovery**: when the server is in the no-content state, treat the first successful per-slide `replace` (or retry a full render after each mutation) as a chance to leave the "Waiting for first update" shell.
3. Root-cause the FormatException in the HTML renderer for this WPS construct.
Related: #294 (watch notification pipe keyed on un-normalized path string) — separate issue found during the same investigation.
Contributor guide
Research direction
Reproduce with `officecli view deck.pptx html` or the private single-slide repro, then compare the HTML renderer with the working SVG and `dump /slide[21]` paths. Trace the `FormatException` and the watch shell's handling of per-slide `replace` events. Done means a failing slide cannot blank the full preview, and `officecli watch` leaves the waiting shell after a successful mutation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, html
- Domain
- backend, cli
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100