{"record":{"id":"45531878015b744f","repo":"BerriAI/litellm","slug":"memory-with-key-key-not-found","errorCode":null,"errorMessage":"Memory with key '{key}' not found","messagePattern":"Memory with key '(.+?)' not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"litellm/proxy/memory/memory_endpoints.py","lineNumber":417,"sourceCode":"            skip=(page - 1) * page_size,\n            take=page_size,\n        )\n    except Exception as e:\n        raise _internal_error(\"Error listing memory: %s\", e, \"Internal error listing memory entries.\")\n\n    return MemoryListResponse(memories=[_row_to_model(r) for r in rows], total=total)\n\n\nasync def _find_memory_for_caller(\n    prisma_client: \"PrismaClient\", key: str, user_api_key_dict: UserAPIKeyAuth\n) -> _MemoryRecord:\n    \"\"\"Look up a memory row by key, scoped to the caller's visibility.\"\"\"\n    key_filter: Final[Mapping[str, object]] = {\"key\": key}\n    vis: Final = _visibility_filter(user_api_key_dict)\n    where: Final[Mapping[str, object]] = key_filter if vis is None else {\"AND\": [key_filter, vis]}\n    rows = await _memory_table(prisma_client).find_many(where=where, take=1, order={\"updated_at\": \"desc\"})\n    if not rows:\n        raise HTTPException(status_code=404, detail=f\"Memory with key '{key}' not found\")\n    return rows[0]\n\n\n@router.get(\n    \"/v1/memory/{key:path}\",\n    tags=[\"memory management\"],\n    dependencies=[Depends(user_api_key_auth)],\n    response_model=LiteLLM_MemoryRow,\n)\nasync def get_memory(\n    key: str,\n    user_api_key_dict: UserAPIKeyAuth = Depends(user_api_key_auth),\n):\n    \"\"\"Get a single memory entry by key, scoped to the caller.\"\"\"\n    prisma_client: Final = _require_prisma()\n    row: Final = await _find_memory_for_caller(prisma_client, key, user_api_key_dict)\n    return _row_to_model(row)\n","sourceCodeStart":399,"sourceCodeEnd":435,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/memory/memory_endpoints.py#L399-L435","documentation":"HTTPException(404) from _find_memory_for_caller: no memory row with the requested key exists within the caller's visibility scope (own user_id/team_id). Used by get/update/delete paths to signal the entry does not exist for this caller.","triggerScenarios":"Thrown at litellm/proxy/memory/memory_endpoints.py:417 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the memory key exists (list memory entries) before reading/updating/deleting it."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}