{"record":{"id":"40a4ad4e6b9e6c3f","repo":"SubtitleEdit/subtitleedit","slug":"translation-engine-translator-name-returned-no-t","errorCode":null,"errorMessage":"Translation engine {translator.Name} returned no translation for line {index + 1} after {noProgressCount} attempts","messagePattern":"Translation engine (.+?) returned no translation for line (.+?) after (.+?) attempts","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/libuilogic/Translate/DoAutoTranslate.cs","lineNumber":116,"sourceCode":"                    return rows.ToList();\n                }\n\n                if (translateCount > 0)\n                {\n                    index += translateCount;\n                    noProgressCount = 0;\n                    Progress?.Invoke(Math.Min(index, subtitle.Paragraphs.Count), subtitle.Paragraphs.Count);\n                }\n                else\n                {\n                    forceSingleLineMode = true;\n\n                    // The engine keeps returning nothing for this line without throwing -\n                    // without a cap the loop would retry the same line forever.\n                    noProgressCount++;\n                    if (noProgressCount > 3)\n                    {\n                        throw new Exception($\"Translation engine {translator.Name} returned no translation for line {index + 1} after {noProgressCount} attempts\");\n                    }\n                }\n            }\n\n            return rows.ToList();\n        }\n        catch (Exception exception)\n        {\n            SeLogger.Error(exception, \"Auto-translate failed\");\n            throw;\n        }\n    }\n}\n","sourceCodeStart":98,"sourceCodeEnd":130,"githubUrl":"https://github.com/SubtitleEdit/subtitleedit/blob/17a9f0748781032255db3526b7215d2fb891e3af/src/libuilogic/Translate/DoAutoTranslate.cs#L98-L130","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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).","Shorten or split the offending paragraph before translating, or pre-strip content the engine chokes on (long base64, exotic scripts).","Switch to a different translate engine for this run; some engines handle the line that another blanks on.","Reproduce by translating just that one line to see the engine's raw response and adjust the prompt/template."],"exampleFix":"// before\nnoProgressCount++;\nif (noProgressCount > 3)\n    throw new Exception($\"Translation engine {translator.Name} returned no translation for line {index + 1} after {noProgressCount} attempts\");\n\n// after — skip the line and continue instead of aborting the whole batch\nnoProgressCount++;\nif (noProgressCount > 3)\n{\n    rows.Add(new TranslationSyncPair(subtitle.Paragraphs[index].Text, subtitle.Paragraphs[index].Text));\n    SeLogger.Warning($\"Engine {translator.Name} returned no translation for line {index + 1}; kept original.\");\n    index++; noProgressCount = 0;\n}","handlingStrategy":"fallback","validationCode":"if (subtitle.Paragraphs[index].Text.Length > translator.MaxContextChars) SplitBeforeTranslate(subtitle, index);","typeGuard":"null","tryCatchPattern":"try { rows = await TranslateAsync(...); }\ncatch (Exception ex) when (ex.Message.Contains(\"returned no translation\"))\n{ SeLogger.Warning(ex, $\"Engine stalled on a line; switching engine or skipping recommended.\"); throw; }","preventionTips":["Pre-split paragraphs longer than the engine's context window.","Have a secondary engine configured to take over when the primary blanks a line.","Log the exact paragraph that stalled so you can reproduce with the engine directly."],"tags":["translate","retry-cap","auto-translate","engine"],"backgroundTag":null,"analyzedSha":"17a9f0748781032255db3526b7215d2fb891e3af","analyzedAt":"2026-08-13T18:11:43.374Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}