SubtitleEdit/subtitleedit · error · Exception

Translation engine {translator.Name} returned no translation

Error message

Translation engine {translator.Name} returned no translation for line {index + 1} after {noProgressCount} attempts

What it means

Generic Exception thrown from DoAutoTranslate when a translator returns no usable output for the same line 4 times in a row (noProgressCount > 3). The cap exists because without it the surrounding loop would retry the same blank-returning line forever — the engine neither throws nor translates. The line index (1-based) and attempt count are in the message.

Source

Thrown at src/libuilogic/Translate/DoAutoTranslate.cs:116

                    return rows.ToList();
                }

                if (translateCount > 0)
                {
                    index += translateCount;
                    noProgressCount = 0;
                    Progress?.Invoke(Math.Min(index, subtitle.Paragraphs.Count), subtitle.Paragraphs.Count);
                }
                else
                {
                    forceSingleLineMode = true;

                    // The engine keeps returning nothing for this line without throwing -
                    // without a cap the loop would retry the same line forever.
                    noProgressCount++;
                    if (noProgressCount > 3)
                    {
                        throw new Exception($"Translation engine {translator.Name} returned no translation for line {index + 1} after {noProgressCount} attempts");
                    }
                }
            }

            return rows.ToList();
        }
        catch (Exception exception)
        {
            SeLogger.Error(exception, "Auto-translate failed");
            throw;
        }
    }
}

View on GitHub (pinned to 17a9f07487)

Solutions

  1. Let the surrounding retry mechanism kick in with forceSingleLineMode enabled (it already is — if the line is still failing, the engine itself cannot handle it).
  2. Shorten or split the offending paragraph before translating, or pre-strip content the engine chokes on (long base64, exotic scripts).
  3. Switch to a different translate engine for this run; some engines handle the line that another blanks on.
  4. Reproduce by translating just that one line to see the engine's raw response and adjust the prompt/template.

Example fix

// before
noProgressCount++;
if (noProgressCount > 3)
    throw new Exception($"Translation engine {translator.Name} returned no translation for line {index + 1} after {noProgressCount} attempts");

// after — skip the line and continue instead of aborting the whole batch
noProgressCount++;
if (noProgressCount > 3)
{
    rows.Add(new TranslationSyncPair(subtitle.Paragraphs[index].Text, subtitle.Paragraphs[index].Text));
    SeLogger.Warning($"Engine {translator.Name} returned no translation for line {index + 1}; kept original.");
    index++; noProgressCount = 0;
}
Defensive patterns

Strategy: fallback

Validate before calling

if (subtitle.Paragraphs[index].Text.Length > translator.MaxContextChars) SplitBeforeTranslate(subtitle, index);

Type guard

null

Try / catch

try { rows = await TranslateAsync(...); }
catch (Exception ex) when (ex.Message.Contains("returned no translation"))
{ SeLogger.Warning(ex, $"Engine stalled on a line; switching engine or skipping recommended."); throw; }

Prevention

When it happens

Trigger: An IAutoTranslator implementation whose Translate returns empty/null/unchanged text repeatedly for one paragraph: content-filter refusal, line too long for context window, prompt format mismatch, or a model stuck emitting only stop tokens.

Common situations: A 5000-char paragraph exceeds the engine's context; engine rejects the input via empty output; chat template mismatch on a self-hosted llama.cpp model produces empty completions; rate-limited cloud engine returns blank.

Related errors


AI-assisted analysis of SubtitleEdit/subtitleedit@17a9f07487 (2026-08-13). Data as JSON: /api/errors/40a4ad4e6b9e6c3f. Report an issue: GitHub.