Malformed chat responses abort the run in the text-generation and QA codegens
@PG1204 is already working on this.
Since Sep 10, 2026.
Assessment
This issue has not been assessed yet.
Description
What happened?
TextGenCodegen.parsePython extracts the chat response with no guard at all:
return body["choices"][0]["message"]["content"]
QaRankingCodegen.parsePython guards only on key presence, at three sites:
if "choices" in body:
return body["choices"][0]["message"]["content"]
Both raise on a malformed provider response rather than degrading:
{"choices": []}→IndexError(thein bodycheck passes, the list is empty){"choices": [{}]}→KeyError: 'message'{"choices": [{"message": {}}]}→KeyError: 'content'
parsePython runs once per row, so a single malformed response from one provider aborts the entire run. The native hf-inference paths in the same functions already degrade politely via body.get("answer", json.dumps(body)), so the two paths are inconsistent.
This path is reachable in practice: of the top 100 models by downloads, 45 for text-generation, 37 for question-answering and 72 for sentence-similarity have a live third-party provider, so the chat branch does execute for these tasks.
This is the same defect #7920 fixed in ImageTaskCodegen, raised in review by @Ma77Ball. The remaining sites are in code merged earlier (#7798) and were left out of that PR to keep the diff focused.
How to reproduce?
Run the operator with text-generation (or any of the QA/ranking tasks) against a model whose cheapest provider is a third-party chat provider, and have that provider return a 200 with an empty choices list or a choice missing message/content. The operator raises and the run aborts, instead of writing the raw body into the result column.
Version/Branch
1.4.0-incubating-SNAPSHOT (main)
Commit Hash (Optional)
No response
What browsers are you seeing the problem on?
No response
Relevant log output
- Dominant language
- Scala
- Stars
- 316
- Forks
- 189
- Avg merge
- 2d 20h
- Merged PRs (30d)
- 198
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from apache/texera
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ergoplatform/ergodocs#614 ·
-
area:ci enhancement requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
apache/datafusion-comet#6078 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
bug delta-datalayout flink
Difficulty 2/5 1-3 hours Newbie friendliness 86/100