# Chroma Db Error at deployment : File is not a database

**URL:** <https://discuss.streamlit.io/t/chroma-db-error-at-deployment-file-is-not-a-database/83388>\
**Category:** Deployment\
**Tags:** database, debugging\
**Created:** [October 13, 2024, 10:11pm UTC](https://discuss.streamlit.io/t/chroma-db-error-at-deployment-file-is-not-a-database/83388 "2024-10-13T22:11:55Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mohamed16](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/mohamed16/32/50753_2.png) [@Mohamed16](https://discuss.streamlit.io/u/Mohamed16)\
**Post date:** [October 13, 2024, 10:11pm UTC](https://discuss.streamlit.io/t/chroma-db-error-at-deployment-file-is-not-a-database/83388/1 "2024-10-13T22:11:55Z")

</div>

Hi,  
I am deploying a Rag app on streamlit that uses chroma db. The app works just fine on local yet when I try to deploy it I get the error: DatabaseError: file is not a database.

Current deployment link: [https://gift-recommendation-chatbot.streamlit.app/](https://gift-recommendation-chatbot.streamlit.app/)  
I have checked that the local version and the one I’m trying to deploy have the same requirements and versions. Both are running on python 3.11

Here is the full Traceback

```auto
────────────────────── Traceback (most recent call last) ───────────────────────

  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  

  nner/exec_code.py:88 in exec_func_with_error_handling                         

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/streamlit/runtime/scriptru  

  nner/script_runner.py:579 in code_to_exec                                     

                                                                                

  /mount/src/gift-recommendation-chatbot/src/Gift_Recommendation_Bot.py:117 in  

  <module>                                                                      

                                                                                

    114 │ │ model=EMBEDDINGS_MODEL_NAME, api_key=st.secrets["TOGETHER_API_  

    115 │ )                                                                   

    116 │ st.text(os.listdir())                                               

  ❱ 117 │ vectorstore = Chroma(                                               

    118 │ │ persist_directory=VECSTORE_PERSIST_DIRECTORY, embedding_functi  

    119 │ )                                                                   

    120 │ st.session_state.retriever = vectorstore.as_retriever(              

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/langchain_chroma/vectorsto  

  res.py:313 in __init__                                                        

                                                                                

     310 │ │ │ else:                                                      

     311 │ │ │ │ _client_settings = chromadb.config.Settings()          

     312 │ │ │ self._client_settings = _client_settings                   

  ❱ 313 │ │ │ self._client = chromadb.Client(_client_settings)           

     314 │ │ │ self._persist_directory = (                                

     315 │ │ │ │ _client_settings.persist_directory or persist_directo  

     316 │ │ │ )                                                          

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/ __init__.py:334    

  in Client                                                                     

                                                                                

    331 │ tenant = str(tenant)                                                

    332 │ database = str(database)                                            

    333 │                                                                       

  ❱ 334 │ return ClientCreator(tenant=tenant, database=database, settings=se  

    335                                                                         

    336                                                                         

    337 def AdminClient(settings: Settings = Settings()) -> AdminAPI:           

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/api/client.py:56   

  in __init__                                                                   

                                                                                

     53 │ │ database: str = DEFAULT_DATABASE,                               

     54 │ │ settings: Settings = Settings(),                                

     55 │ ) -> None:                                                          

  ❱ 56 │ │ super(). __init__ (settings=settings)                             

     57 │ │ self.tenant = tenant                                            

     58 │ │ self.database = database                                        

     59 │ │ # Create an admin client for verifying that databases and tena  

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/api/shared_system  

  _client.py:19 in __init__                                                     

                                                                                

    16 │ │ settings: Settings = Settings(),                                 

    17 │ ) -> None:                                                           

    18 │ │ self._identifier = SharedSystemClient._get_identifier_from_sett  

  ❱ 19 │ │ SharedSystemClient._create_system_if_not_exists(self._identifie  

    20 │                                                                        

    21 │ @classmethod                                                         

    22 │ def _create_system_if_not_exists(                                    

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/api/shared_system  

  _client.py:32 in _create_system_if_not_exists                                 

                                                                                

    29 │ │ │ new_system.instance(ProductTelemetryClient)                  

    30 │ │ │ new_system.instance(ServerAPI)                               

    31 │ │ │                                                                

  ❱ 32 │ │ │ new_system.start()                                           

    33 │ │ else:                                                            

    34 │ │ │ previous_system = cls._identifier_to_system[identifier]      

    35                                                                          

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/config.py:429 in   

  start                                                                         

                                                                                

    426 │ def start(self) -> None:                                            

    427 │ │ super().start()                                                 

    428 │ │ for component in self.components():                             

  ❱ 429 │ │ │ component.start()                                           

    430 │                                                                       

    431 │ @override                                                           

    432 │ def stop(self) -> None:                                             

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/telemetry/opentel  

  emetry/ __init__.py:146 in wrapper                                             

                                                                                

    143 │ │ │ def wrapper(*args, **kwargs):                               

    144 │ │ │ │ global tracer, granularity                              

    145 │ │ │ │ if trace_granularity < granularity:                     

  ❱ 146 │ │ │ │ │ return f(*args, **kwargs)                           

    147 │ │ │ │ if not tracer:                                          

    148 │ │ │ │ │ return f(*args, **kwargs)                           

    149 │ │ │ │ with tracer.start_as_current_span(trace_name, attribut  

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/db/impl/sqlite.py  

  :104 in start                                                                 

                                                                                

    101 │ │ with self.tx() as cur:                                          

    102 │ │ │ cur.execute("PRAGMA foreign_keys = ON")                     

    103 │ │ │ cur.execute("PRAGMA case_sensitive_like = ON")              

  ❱ 104 │ │ self.initialize_migrations()                                    

    105 │ │                                                                   

    106 │ │ if (                                                            

    107 │ │ │ # (don't attempt to access .config if migrations haven't b  

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/db/migrations.py:  

  140 in initialize_migrations                                                  

                                                                                

    137 │ │ │ self.validate_migrations()                                  

    138 │ │                                                                   

    139 │ │ if migrate == "apply":                                          

  ❱ 140 │ │ │ self.apply_migrations()                                     

    141 │                                                                       

    142 │ @trace_method("MigratableDB.validate_migrations", OpenTelemetryGra  

    143 │ def validate_migrations(self) -> None:                              

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/telemetry/opentel  

  emetry/ __init__.py:146 in wrapper                                             

                                                                                

    143 │ │ │ def wrapper(*args, **kwargs):                               

    144 │ │ │ │ global tracer, granularity                              

    145 │ │ │ │ if trace_granularity < granularity:                     

  ❱ 146 │ │ │ │ │ return f(*args, **kwargs)                           

    147 │ │ │ │ if not tracer:                                          

    148 │ │ │ │ │ return f(*args, **kwargs)                           

    149 │ │ │ │ with tracer.start_as_current_span(trace_name, attribut  

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/db/migrations.py:  

  165 in apply_migrations                                                       

                                                                                

    162 │ @trace_method("MigratableDB.apply_migrations", OpenTelemetryGranul  

    163 │ def apply_migrations(self) -> None:                                 

    164 │ │ """Validate existing migrations, and apply all new ones."""     

  ❱ 165 │ │ self.setup_migrations()                                         

    166 │ │ for dir in self.migration_dirs():                               

    167 │ │ │ db_migrations = self.db_migrations(dir)                     

    168 │ │ │ source_migrations = find_migrations(                        

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/telemetry/opentel  

  emetry/ __init__.py:146 in wrapper                                             

                                                                                

    143 │ │ │ def wrapper(*args, **kwargs):                               

    144 │ │ │ │ global tracer, granularity                              

    145 │ │ │ │ if trace_granularity < granularity:                     

  ❱ 146 │ │ │ │ │ return f(*args, **kwargs)                           

    147 │ │ │ │ if not tracer:                                          

    148 │ │ │ │ │ return f(*args, **kwargs)                           

    149 │ │ │ │ with tracer.start_as_current_span(trace_name, attribut  

                                                                                

  /home/adminuser/venv/lib/python3.11/site-packages/chromadb/db/impl/sqlite.py  

  :171 in setup_migrations                                                      

                                                                                

    168 │ @override                                                           

    169 │ def setup_migrations(self) -> None:                                 

    170 │ │ with self.tx() as cur:                                          

  ❱ 171 │ │ │ cur.execute(                                                

    172 │ │ │ │ """                                                     

    173 │ │ │ │ │ CREATE TABLE IF NOT EXISTS migrations (             

    174 │ │ │ │ │ │ dir TEXT NOT NULL,                              

────────────────────────────────────────────────────────────────────────────────

DatabaseError: file is not a database

2024-10-13 22:03:55.900 503 GET /script-health-check (127.0.0.1) 540.93ms

```

---

<div class="post-metadata">

**Author:** ![Goyo](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/goyo/32/28219_2.png) [@Goyo](https://discuss.streamlit.io/u/Goyo)\
**Post date:** [October 13, 2024, 11:03pm UTC](https://discuss.streamlit.io/t/chroma-db-error-at-deployment-file-is-not-a-database/83388/2 "2024-10-13T23:03:39Z")

</div>

Your [database](https://github.com/Medkallel/Gift-Recommendation-Chatbot/blob/8e78ad3ed0bf09d1896ad7246d7f8c3a4d96ecc6/chroma_vectorstore/chroma.sqlite3) doesn’t really look like a sqlite database.

This seems to be related to git LFS. I have never used it and I don’t know what should be done, you may need to store the database somewhere else.

---

<div class="post-metadata">

**Author:** ![Mohamed16](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/mohamed16/32/50753_2.png) [@Mohamed16](https://discuss.streamlit.io/u/Mohamed16)\
**Post date:** [October 13, 2024, 11:08pm UTC](https://discuss.streamlit.io/t/chroma-db-error-at-deployment-file-is-not-a-database/83388/3 "2024-10-13T23:08:45Z")

</div>

Thanks ,  
It is indeed pushed to github via lfs. That apparently requires me to puth the .gitattributes files so that streamlit can download the file.  
However - and i found that in another topic here too - the .gitattributes file generates the following problem:

```auto
 🚀 Starting up repository: 'gift-recommendation-chatbot', branch: 'main', main module: 'src/Gift_Recommendation_Bot.py'

[23:07:22] 🐙 Cloning repository...

[23:07:26] 🐙 Failed

[23:07:36] 🐙 Failed

```

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [April 11, 2025, 11:09pm UTC](https://discuss.streamlit.io/t/chroma-db-error-at-deployment-file-is-not-a-database/83388/4 "2025-04-11T23:09:15Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
