tts_sentence_selection_invalid 422 on Sume TTS: what triggers it
Sume TTS returns 422 tts_sentence_selection_invalid for gaps, repeated jobs, unfinished jobs and partial coverage. Each cause and its fix.

tts_sentence_selection_invalid is an HTTP 422 from Sume's script-source API. It means the sentence ids you sent do not form a valid selection of the accepted script. The code is raised in several places in the source service and the spine verifier, and each has a different fix. All of these come back in Sume's standard error envelope with an HTTP status and a stable code, so branch on the code, not the message text.
The source API works in two steps. You accept script blocks and get back a script_revision_id plus sentence ids such as sent_000000. Then you either generate with transcript_source: {script_revision_id, sentence_ids} or you ask POST /v1/tts-1.0/source/verify-spine whether a set of finished jobs covers the whole script. The 422 shows up in both steps. Source resolution is thread-scoped: a request with transcript_source but no thread behind it gets 400 tts_text_source_required ("Source resolution requires a thread."). The literal transcript path has no such requirement.
The six causes
| Where it fires | Message | Fix |
|---|---|---|
| Generate with transcript_source | Select contiguous complete sentences in source order. | Send ids that are adjacent in the manifest, in order, no skipped sentence. |
| verify-spine | Selected spine cannot repeat a job. | List each job_id once in selected_jobs. |
| verify-spine | Selected spine requires completed TTS jobs. | Wait until every job is completed and is a text_to_speech job. |
| verify-spine | Selected sentence IDs differ from the trusted job receipt. | Drop sentence_ids and let the job's receipt speak, or pass exactly the ids the job read. |
| verify-spine | Selected spine must cover the accepted sentences exactly once in source order. | Cover every sentence once; no overlap, no gap, in manifest order. |
Gap versus overlap
The generate path checks adjacency by index in the revision. Ids sent_000002 and sent_000004 fail because sent_000003 sits between them, even though the order is right. Ids sent_000004 then sent_000002 fail too. Duplicate ids are refused earlier by the request schema, which requires sentence_ids to be unique and in source order.
The spine check is stricter than one generate call: the selected jobs together must cover every accepted sentence exactly once. A common miss is regenerating one sentence after an edit and forgetting to keep the unchanged jobs in the list, which leaves a gap.
A quick way to find the gap
Read the manifest with GET /v1/tts-1.0/source?script_revision_id=.... It lists sentence_ids in order and one entry per sentence with source_block_index, sentence_index and character_count. Compare your ids against that list before you submit; the check is free and no job is created by it.
curl -s "https://api.sume.com/v1/tts-1.0/source?script_revision_id=$REV" \
-H "x-api-key: $SUME_API_KEY"Retrying
A 422 here happens before any provider dispatch, so nothing is generated and no TTS price is charged for the failed request. Fix the selection and resubmit. Sume's text-to-speech price is $0.0475 per 1,000 characters on the characters actually resolved, so a corrected 900-character selection is $0.05.
Sources
Related posts
More in Developers
- tts_source_integrity_mismatch 422: job differs from accepted script
verify-spine returns 422 tts_source_integrity_mismatch when a finished TTS job's text no longer matches the accepted script. What it checks and how to recover.
- tts_source_not_found 404 on Sume TTS: revision, sentence or job
A 404 tts_source_not_found from the Sume script-source API means the revision, a sentence id or a selected job is not visible to this key or thread.
- tts_source_revision_mismatch 409: stale expected_script_revision_id
Sume returns 409 tts_source_revision_mismatch when the accepted script changed under you or a run is frozen. How to re-read the revision and retry.
- tts_source_too_large 422: Sume TTS 20,000-character cap on a selection
A transcript_source selection that resolves past 20,000 characters returns 422 tts_source_too_large. Split it by sentence ids and price each job.
Written by Sume