Convert-stats on a stat-less entry shows a scary "LLM failed" error #233

Closed
opened 2026-07-21 18:40:37 +00:00 by claude-bot · 1 comment
Contributor

Problem

Running stat conversion (#145) on a lore entry whose prose contains no mappable stats — e.g. an NPC like Ravenshade ("Owner of a small tea shop and bookstore") — surfaces a red "The LLM failed to produce a draft" banner with "The source material did not contain any stats that map to this game system's schema." The LLM did not fail: it ran correctly and found nothing to convert.

Root cause (confirmed, working-as-designed)

convert_lore_entry_stats deliberately never invents — it maps ONLY what's in the source. When the model returns a well-formed but empty values object, audio_service.py:1821 raises ValueError, which the draft-review UI renders with its generic failure chrome.

Reproduced live on Dev against qwen3.5:

  • Ravenshade's real body → empty mapping (or a trivial {size: "Medium"} inference on some rolls) → the error.
  • A synthetic stat-bearing body ("AC 15, HP 44 … CR 3") → a full valid PF2e stat block.

So the pipeline is correct; convert-stats simply has nothing to map for a pure-flavor NPC.

Desired behavior

Distinguish "nothing to convert" from a genuine failure:

  • Backend: signal the empty-mapping case distinctly (dedicated error code / flag on the failed draft) rather than a generic ValueError.
  • Frontend (draft-review): render it as a gentle informational state, not a red "LLM failed" banner, and steer the GM to "generate a stat block from scratch" (the right tool for a stat-less NPC) or to add stat text first.

Backend + frontend; no contract bump. Target v3.10.0.

🤖 Generated with Claude Code

## Problem Running **stat conversion** (#145) on a lore entry whose prose contains no mappable stats — e.g. an NPC like *Ravenshade* ("Owner of a small tea shop and bookstore") — surfaces a red **"The LLM failed to produce a draft"** banner with *"The source material did not contain any stats that map to this game system's schema."* The LLM did **not** fail: it ran correctly and found nothing to convert. ## Root cause (confirmed, working-as-designed) `convert_lore_entry_stats` deliberately never invents — it maps ONLY what's in the source. When the model returns a well-formed but empty `values` object, [audio_service.py:1821](webapp/backend/app/services/audio_service.py#L1821) raises `ValueError`, which the draft-review UI renders with its generic **failure** chrome. Reproduced live on Dev against `qwen3.5`: - Ravenshade's real body → empty mapping (or a trivial `{size: "Medium"}` inference on some rolls) → the error. - A synthetic stat-bearing body ("AC 15, HP 44 … CR 3") → a **full valid PF2e stat block**. So the pipeline is correct; convert-stats simply has nothing to map for a pure-flavor NPC. ## Desired behavior Distinguish "**nothing to convert**" from a genuine failure: - Backend: signal the empty-mapping case distinctly (dedicated error code / flag on the failed draft) rather than a generic `ValueError`. - Frontend (draft-review): render it as a **gentle informational** state, not a red "LLM failed" banner, and **steer the GM to "generate a stat block from scratch"** (the right tool for a stat-less NPC) or to add stat text first. Backend + frontend; no contract bump. Target **v3.10.0**. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Contributor

Done — shipped in v3.10.0 (merged via #225). Converting an entry whose text has no mappable stats now shows a gentle amber "Nothing to convert" state that steers the GM to generate a stat block from scratch, instead of the red "The LLM failed to produce a draft" banner. Implemented as frontend-only detection of the empty-mapping case in the draft-review banner (the message is unique to convert_lore_entry_stats), so no schema change.

Done — shipped in **v3.10.0** (merged via #225). Converting an entry whose text has no mappable stats now shows a gentle amber **"Nothing to convert"** state that steers the GM to *generate a stat block from scratch*, instead of the red "The LLM failed to produce a draft" banner. Implemented as frontend-only detection of the empty-mapping case in the draft-review banner (the message is unique to `convert_lore_entry_stats`), so no schema change.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#233
No description provided.