If you're encountering the "Cannot read properties of undefined (reading 'length')" error when trying to select a Data Hubin your TeamAI chats, don't worry. This issue typically occurs for users who have their own configuration of Data Hubs, 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 Data Hubs, TeamAI needs to extract the content (i.e., the embeddings) from the Data Hubs 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:
Your OpenAI API key is out of credits or invalid.
Your Qdrant cluster is not reachable.
Troubleshooting Steps
Step 1: Check Your OpenAI API Key
Visit the OpenAI API platform (https://platform.openai.com).
Verify that your API key is valid and has sufficient credits.
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
Open your terminal.
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}"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
Visit the Qdrant Cloud website (https://cloud.qdrant.io/).
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.
If your cluster is inactive, reactivate it and try the cURL request again.
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 Data Hub 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.