From 63327c3ad020ab54e74e7a4e067852fd0f4965cd Mon Sep 17 00:00:00 2001 From: waleed Date: Sun, 3 May 2026 02:36:38 -0700 Subject: [PATCH 1/2] fix(memory): return 200 with null data when memory key not found on GET --- apps/sim/app/api/memory/[id]/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/sim/app/api/memory/[id]/route.ts b/apps/sim/app/api/memory/[id]/route.ts index 2928fd8b42..9cc7b5ccc0 100644 --- a/apps/sim/app/api/memory/[id]/route.ts +++ b/apps/sim/app/api/memory/[id]/route.ts @@ -86,7 +86,7 @@ export const GET = withRouteHandler(async (request: NextRequest, context: Memory .limit(1) if (memories.length === 0) { - return memoryEnvelopeError('Memory not found', 404) + return NextResponse.json({ success: true, data: null }, { status: 200 }) } const mem = memories[0] From 840b9dca6340b3f21d455aeb726646f8774a3f28 Mon Sep 17 00:00:00 2001 From: waleed Date: Sun, 3 May 2026 02:40:59 -0700 Subject: [PATCH 2/2] test(memory): add null-data path test for memory_get transformResponse --- apps/sim/tools/memory/get.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/sim/tools/memory/get.test.ts b/apps/sim/tools/memory/get.test.ts index 0b7177d19d..862ca367d1 100644 --- a/apps/sim/tools/memory/get.test.ts +++ b/apps/sim/tools/memory/get.test.ts @@ -36,6 +36,20 @@ describe('memoryGetTool', () => { expect(url).toBe('/api/memory/team%2Fuser%20123?workspaceId=workspace-1') }) + it('returns empty memories when key is not found (null data)', async () => { + const result = await transformResponse( + new Response(JSON.stringify({ success: true, data: null })) + ) + + expect(result).toEqual({ + success: true, + output: { + memories: [], + message: 'No memories found', + }, + }) + }) + it('wraps the exact memory response as a single result', async () => { const result = await transformResponse( new Response(