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.

5 min readSume
All posts

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

Causes of tts_sentence_selection_invalid in the Sume source code and the fix for each
Where it firesMessageFix
Generate with transcript_sourceSelect contiguous complete sentences in source order.Send ids that are adjacent in the manifest, in order, no skipped sentence.
verify-spineSelected spine cannot repeat a job.List each job_id once in selected_jobs.
verify-spineSelected spine requires completed TTS jobs.Wait until every job is completed and is a text_to_speech job.
verify-spineSelected 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-spineSelected 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

All Developers posts

Written by Sume