Skip to content

Commit 5d18599

Browse files
BirdInTheTreeclaude
andcommitted
Fix narratology pipeline crash on null protagonists from Pass 1
Pass 1 occasionally returns null entries inside the protagonists array. The cast-building loop then called .toLowerCase() on null and aborted the entire run with "Cannot read properties of null (reading 'toLowerCase')". Filter out non-string and empty entries before the loop. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 32e2364 commit 5d18599

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Unreleased
44

5+
### Fixed
6+
- **Narratology pipeline crash when Pass 1 returns null/non-string protagonists.** Pass 1 occasionally emits `null` entries inside the `protagonists` array; the cast-building loop then called `.toLowerCase()` on `null` and aborted the entire pipeline with `Cannot read properties of null (reading 'toLowerCase')`. The viewer now filters non-string and empty entries before the loop.
7+
58
### Changed
69
- **Default Anthropic model: `claude-sonnet-4-20250514``claude-sonnet-4-6`.** Old dated model ID returns 404 from the Anthropic API. New default uses the current Sonnet 4.6 short alias in both the Python library (`llm.py`) and the standalone HTML viewer (`pipeline.js`). Pricing table updated. Users with the old model in localStorage are unaffected (override still wins); users on defaults need a hard refresh of the viewer.
710
- **Welcome/landing flow in the HTML viewer.** Returning visits no longer auto-open the bundled Breaking Bad demo. Instead, the viewer opens the user's most-recently-viewed saved analysis, or falls back to the welcome screen when nothing is saved. The `#demo` URL hash still force-loads the demo (used by the onboarding animation).

src/tvplot/html/parts/pipeline.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1676,7 +1676,8 @@ async function runPipelineNarratology(synopses, seriesName, provider, apiKey, on
16761676
genre: p1.genre || '',
16771677
is_anthology: !!p1.is_anthology,
16781678
};
1679-
const protagonists = Array.isArray(p1.protagonists) ? p1.protagonists : [];
1679+
const protagonists = (Array.isArray(p1.protagonists) ? p1.protagonists : [])
1680+
.filter(p => typeof p === 'string' && p.trim());
16801681

16811682
// Pass 2 — fabula (parallel per episode)
16821683
onProgress('Pass 2/6: fabula (events, cast)…', 2, totalPasses);

0 commit comments

Comments
 (0)