Skip to main content
All CollectionsDatastores
Troubleshooting the "Cannot read properties of undefined (reading 'length')" Error in TeamAI Datastore Chats
Troubleshooting the "Cannot read properties of undefined (reading 'length')" Error in TeamAI Datastore Chats
M
Written by Muhammad Jawad
Updated over a week ago

If you're encountering the "Cannot read properties of undefined (reading 'length')" error when trying to select a datastore in your TeamAI chats, don't worry. This issue typically occurs for users who have their own configuration of datastores, such as those on the Sumo plan or our old Pro users with their own setup of Qdrant databases. In this article, we'll guide you through the steps to troubleshoot and resolve this error.


Understanding the Error

When chatting with datastores, TeamAI needs to extract the content (i.e., the embeddings) from the datastores inside your Qdrant database. To access and search these embeddings, you need to have a working OpenAI API key with access to the embedding model, and your Qdrant database must be reachable.

The "Cannot read properties of undefined (reading 'length')" error can occur due to two main reasons:

  1. Your OpenAI API key is out of credits or invalid.

  2. Your Qdrant cluster is not reachable.

Troubleshooting Steps

Step 1: Check Your OpenAI API Key

  1. Visit the OpenAI API platform (https://platform.openai.com).

  2. Verify that your API key is valid and has sufficient credits.

  3. If your API key is invalid or out of credits, generate a new key or add more credits to your account.

Step 2: Check Your Qdrant Cluster Reachability

  1. Open your terminal.

  2. Run the following cURL request, replacing ${QDRANT_URL} and ${QDRANT_API_KEY} with your actual Qdrant database URL and API key:

    curl -X GET "${QDRANT_URL}/cluster" \
    -H "api-key: ${QDRANT_API_KEY}"

  3. If the request is successful, your Qdrant cluster is reachable. If you see a 404 error or the request fails, proceed to the next step.

Step 3: Troubleshoot Your Qdrant Cluster

  1. Visit the Qdrant Cloud website (https://cloud.qdrant.io/).

  2. Check if your Qdrant cluster has been set to an inactive state automatically due to inactivity. This can happen if you're a free Qdrant user and haven't used the service for a few days.

  3. If your cluster is inactive, reactivate it and try the cURL request again.

  4. If the issue persists, reach out to the Qdrant support team for further assistance.

Conclusion

Encountering the "Cannot read properties of undefined (reading 'length')" error when trying to select a datastore in your TeamAI chats can be frustrating, but it's usually a straightforward issue to resolve. By checking your OpenAI API key and verifying your Qdrant cluster's reachability, you can quickly identify and address the root cause of the problem. If you've followed the troubleshooting steps outlined in this article and are still experiencing issues, don't hesitate to reach out to our support team for further assistance.

Did this answer your question?