Repository navigation
fix(ts-sdk): re-raise LLM extraction transport failures instead of returning [] - #6102
Merged
blazingretinol merged 2 commits intoJul 10, 2026
Conversation
…turning [] Memory.add()'s LLM extraction step in the TS OSS SDK caught all errors from generateResponse -- including provider/transport failures (rate limits, timeouts, connection errors) -- and swallowed them by returning []. This made "the LLM is unreachable" indistinguishable from "the LLM ran and extracted nothing," leaving callers unable to detect or retry. Adds a typed LLMError and throws it from the transport-failure catch block in mem0-ts/src/oss/src/memory/index.ts, mirroring the Python SDK fix (mem0ai#5878). The downstream JSON-parse-failure path is untouched and still returns [] for a genuinely empty/invalid LLM response. Closes mem0ai#6101
Contributor
Author
|
Hey @kartik-mem0 Summary of the change and verification is in the PR description. A couple of notes for review:
Happy to adjust the error shape/naming if you'd prefer something different. Let me know if anything else is needed! |
blazingretinol
approved these changes
Jul 10, 2026
1 task done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue
Closes #6101
Description
Memory.add()'s LLM extraction step in the TypeScript OSS SDK caught all errors fromgenerateResponse, including provider/transport failures (rate limits, timeouts, connection errors) and swallowed themby returning
[]. This made "the LLM is unreachable" indistinguishable from "the LLM ran and extracted nothing," and callers had no way to detect or retry the former.This mirrors the Python SDK bug already fixed by #5878 (tracked in #5903, which explicitly flagged this TS-side follow-up).
Before (
mem0-ts/src/oss/src/memory/index.ts:855-858):After:
Adds a typed
LLMErrorclass (alongside the existing error-handling patterns in this file) so callers can distinguish a transport failure from a genuinely empty/invalid LLM response. The downstream JSON-parse failure path is untouched and still returns[], since that case really is "no facts extracted," not a transport error.Type of Change
Breaking Changes
N/A
Test Coverage
Added
mem0-ts/src/oss/tests/memory.llm-error.test.tswith two regression tests mirroring the Python regression test added in #5878 (test_llm_extraction_exception_is_reraised):add()rejects withLLMErrorinstead of resolving with an empty resultLLMErrorpreserves the original error as.causeAlso ran the full related suite with zero regressions (
memory.add,memory.validation,memory.crud,memory.init,memory.entity-boost— 80/80 passing), the full OSS suite (580/623 passing, the 43 failures are pre-existing WindowsEPERMtemp-dir issues in unrelated sqlite/vector-store tests, verified identical on unmodifiedmain),tsc --noEmit(no new errors), and atsupbuild (confirmedLLMErroris correctly exported from the publicdist/oss/index.d.tssurface).Checklist