#4311 TaskCfgSTS(is_cuda=False, uuid='b3ba860941', cache_folder=None, target_dir='E:/PH', source_language=None, source_languag

202.150* Posted at: 9 hours ago 👁14

Trans Error [Local/Compatible AI] Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=16384, prompt_tokens=24279, total_tokens=40663, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=0, rejected_prediction_tokens=None), prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=24192))
Traceback (most recent call last):
File "videotrans\task\job.py", line 174, in run
File "videotrans\task\_translate_srt.py", line 45, in trans
File "videotrans\translator\__init__.py", line 970, in run
File "videotrans\translator\_base.py", line 102, in run
File "videotrans\translator\_base.py", line 165, in _run_srt
File "tenacity\__init__.py", line 338, in wrapped_f
File "tenacity\__init__.py", line 477, in call
File "tenacity\__init__.py", line 378, in iter
File "tenacity\__init__.py", line 400, in
File "concurrent\futures\_base.py", line 451, in result
File "concurrent\futures\_base.py", line 403, in __get_result
File "tenacity\__init__.py", line 480, in call
File "videotrans\translator\_localllm.py", line 72, in _item_task
openai.LengthFinishReasonError: Could not parse response content as the length limit was reached - CompletionUsage(completion_tokens=16384, prompt_tokens=24279, total_tokens=40663, completion_tokens_details=CompletionTokensDetails(accepted_prediction_tokens=None, audio_tokens=None, reasoning_tokens=0, rejected_prediction_tokens=None), prompt_tokens_details=PromptTokensDetails(audio_tokens=None, cached_tokens=24192))
TaskCfgSTS(is_cuda=False, uuid='b3ba860941', cache_folder=None, target_dir='E:/PH', source_language=None, source_language_code='Korean', source_sub='E:/PH/2.srt', source_wav=None, source_wav_output=None, target_language=None, target_language_code='English', target_sub='E:/PH/2.English.srt', target_wav=None, target_wav_output=None, name='E:/PH/2.srt', noextname='2', basename='2.srt', ext='srt', dirname='E:/PH', shound_del_name=None, translate_type=8)


=
system:Windows-10-10.0.26200-SP0
version:v3.97
frozen:True
language:en
root_dir:E:/ytrans

1 Replies

This error is caused by sending an excessively large translation request to the AI model, exceeding its maximum output token limit. The model hit its max_tokens cap (likely 16 384 tokens in this case) before finishing the translation, resulting in an incomplete response that cannot be parsed.

How to fix:

  1. Reduce batch size – In Menu > Tools/Options > Advanced Options > 字幕翻译调整, lower the AI翻译渠道每批字幕行数 (e.g., from the default 100 down to 10–20). Sending fewer lines per request keeps the prompt and completion tokens within the model’s limits.
  2. Disable full‑subtitle sending – Uncheck the 发送完整字幕 option (both on the main interface and in the advanced settings). Sending the entire SRT with timestamps dramatically increases prompt tokens.
  3. Use a more capable model – If you need large batches, switch to a local or remote model with a larger context window (e.g., DeepSeek‑V3, GPT‑4, Claude) that can handle 32 768+ tokens. Ensure your model’s max_tokens parameter is set high enough.
  4. Check the model’s configuration – If you are using a local LLM via Ollama, verify its serving settings allow a large enough num_predict (or max_tokens) for the desired batch size.

After making these changes, re‑run the translation task.

Please refer to related documentation:

Post Your Reply
Open source and free maintenance is not easy. If this project is helpful to you, please consider making a small donation to help the project continue to maintain and update.

Related resource