Chroma.from_documents() raises sqlite3.OperationalError: attempt to write a readonly database

Using Chroma as a persistent vector store via Chroma.fromdocuments(docs, embedding, persistdirectory=...) on Ubuntu with langchain 0.0.351. The first creation worked, but deleting the persist directory with shutil.rmtree and recreating the store in the same process raised sqlite3.OperationalError: attempt to write a readonly database. The reporter confirmed the same directory path and that creation only worked on first run, not after re-ingest.

The original reporter confirmed this fix worked: pip install --upgrade chromadb==0.4.14, and several other users said the same. The underlying cause identified in the thread is a stale sqlite connection that survives the directory deletion, so restarting the Jupyter kernel or otherwise clearing active connections before recreating the store also avoids it (one user used client.reset() plus clearsystemcache() before deleting). Caveat: a few users reported the downgrade did not fix it for them, so treat chromadb==0.4.14 as the confirmed workaround for the reported case rather than a universal fix. Source: https://github.com/langchain-ai/langchain/issues/14872