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."""