Fresh Piper/LibriTTS voice needs a page reload after first download #31

Closed
opened 2026-11-04 10:06:55 +00:00 by dsh · 2 comments
Owner

Symptom

After downloading a voice for the first time, the first synthesis fails with:

Can't create a session. ERROR_CODE: 2, ERROR_MESSAGE: No graph was found in the protobuf.

Reloading the page makes the same voice work.

Root cause

piper-tts-web@1.0.5's download() starts writeBlob(url, await fetchBlob(...)) without awaiting it, so it resolves while the ONNX/config writes are still in flight. The first predict() reads a partial/empty model blob. A reload gives the write time to finish.

Fix

  • Build patch now rewrites the pinned download body to await writeBlob(...) for both model and config (asserted, so a version bump fails loudly).
  • The Piper worker clears TtsSession._instance after a download, so a failed first session cannot be reused.

Commit bb8e001.

Verification

  1. Remove the voice / clear its OPFS entry.
  2. Download and preview without reloading — first synthesis must work.
  3. Repeat for a LibriTTS speaker and a Piper voice.
## Symptom After downloading a voice for the first time, the first synthesis fails with: ``` Can't create a session. ERROR_CODE: 2, ERROR_MESSAGE: No graph was found in the protobuf. ``` Reloading the page makes the same voice work. ## Root cause `piper-tts-web@1.0.5`'s `download()` starts `writeBlob(url, await fetchBlob(...))` **without awaiting it**, so it resolves while the ONNX/config writes are still in flight. The first `predict()` reads a partial/empty model blob. A reload gives the write time to finish. ## Fix - Build patch now rewrites the pinned download body to `await writeBlob(...)` for both model and config (asserted, so a version bump fails loudly). - The Piper worker clears `TtsSession._instance` after a download, so a failed first session cannot be reused. Commit `bb8e001`. ## Verification 1. Remove the voice / clear its OPFS entry. 2. Download and preview **without reloading** — first synthesis must work. 3. Repeat for a LibriTTS speaker and a Piper voice.
Author
Owner

Still reproduces after bb8e001 (awaiting the OPFS writes + resetting the Piper session). The missing await was a real bug, but not the whole cause. Next step: local DSH session with browser/CDP access, inspect the actual OPFS blob size before InferenceSession.create and compare a reloaded vs fresh-download path. Keep open; handoff context in #30.

Still reproduces after `bb8e001` (awaiting the OPFS writes + resetting the Piper session). The missing `await` was a real bug, but not the whole cause. Next step: local DSH session with browser/CDP access, inspect the actual OPFS blob size before `InferenceSession.create` and compare a reloaded vs fresh-download path. Keep open; handoff context in #30.
Author
Owner

Verified fixed on the 2026-11-06 build. The awaited OPFS writes plus the session reset resolved the fresh-download failure; re-tested after download without reload.

Verified fixed on the 2026-11-06 build. The awaited OPFS writes plus the session reset resolved the fresh-download failure; re-tested after download without reload.
dsh closed this issue 2026-11-06 10:48:11 +00:00
Sign in to join this conversation.
No description provided.