mirror of
https://github.com/Shubhamsaboo/awesome-llm-apps.git
synced 2026-07-17 17:05:58 -05:00
[GH-ISSUE #841] bug: unguarded OpenAI API response access crashes memory tutorial apps #14233
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zavoryn on GitHub (May 25, 2026).
Original GitHub issue: https://github.com/Shubhamsaboo/awesome-llm-apps/issues/841
Bug Description
Four apps in
advanced_llm_apps/llm_apps_with_memory_tutorials/accessresponse.choices[0].message.contentwithout first checking thatchoicesis non-empty andcontentis notNone.This can cause:
IndexErrorwhen the API returns an emptychoiceslist (content filter, quota exceeded, or transient error)Nonebeing passed to downstream code whenmessage.contentisNoneAffected Files
ai_arxiv_agent_memory/ai_arxiv_agent_memory.pyresponse.choices[0].message.contentai_travel_agent_memory/travel_agent_memory.pyresponse.choices[0].message.contentllm_app_personalized_memory/llm_app_memory.pyresponse.choices[0].message.contentmulti_llm_memory/multi_llm_memory.pyresponse.choices[0].message.contentFix
Add the same guard applied in PR #820 and PR #840 before each access:
I have a PR ready fixing all four files.
@Shubhamsaboo commented on GitHub (Jun 2, 2026):
Thanks for the detailed report. The proposed fix in #842 was reviewed and closed without merging, so we're closing this issue to match. The unguarded access is a minor defensive edge case (it only triggers on an empty
choiceslist orNonecontent from a content filter or quota), and we're not planning to add the guards across these tutorial apps right now. If it resurfaces as an actual crash in practice, we can revisit.Generated by Claude Code