From e0dc25c757e03013e3e1555dea81eacc9d272d41 Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Wed, 11 Mar 2026 09:28:35 -0400 Subject: [PATCH] fix: narrow ValueError catch in _create_table and increase test timeout --- lib/crewai/src/crewai/memory/storage/lancedb_storage.py | 3 ++- lib/crewai/tests/memory/test_concurrent_storage.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/crewai/src/crewai/memory/storage/lancedb_storage.py b/lib/crewai/src/crewai/memory/storage/lancedb_storage.py index 08ca68483..424898d52 100644 --- a/lib/crewai/src/crewai/memory/storage/lancedb_storage.py +++ b/lib/crewai/src/crewai/memory/storage/lancedb_storage.py @@ -210,9 +210,10 @@ class LanceDBStorage: ] try: table = self._db.create_table(self._table_name, placeholder) - table.delete("id = '__schema_placeholder__'") except ValueError: table = self._db.open_table(self._table_name) + else: + table.delete("id = '__schema_placeholder__'") return table def _ensure_scope_index(self) -> None: diff --git a/lib/crewai/tests/memory/test_concurrent_storage.py b/lib/crewai/tests/memory/test_concurrent_storage.py index 86ef50771..f31264847 100644 --- a/lib/crewai/tests/memory/test_concurrent_storage.py +++ b/lib/crewai/tests/memory/test_concurrent_storage.py @@ -13,7 +13,6 @@ import multiprocessing import os import sqlite3 import tempfile -from pathlib import Path import pytest @@ -166,6 +165,7 @@ def _run_workers(target, args_fn, n_workers=N_WORKERS, timeout=120): return successes, errors +@pytest.mark.timeout(120) class TestConcurrentLanceDB: """Concurrent multi-process writes to LanceDB."""