Error: Last Unit Does Not Have Enough Valid Bits
Issue
While running connection setup tests, the following error appears:
Unable to connect to Cosmos: Failed to construct CosmosClient. Exception: Last unit does not have enough valid bits
Environment
Connector: Azure Cosmos DB for NoSQL
Resolution
To resolve this issue, do the following:
- In your Azure Cosmos DB instance, copy the primary or secondary read-only key. To learn how, see our Find Azure credentials documentation.
- In Fivetran, go to your Azure Cosmos DB for NoSQL connection page.
- Select the Setup tab.
- Click Edit connection.
- In the Account Key field, enter the read-only key you found in step 1. Ensure the value contains no spaces or missing characters.
- Click Save & Test.
Cause
This issue occurs when you configure your connection with an incorrect or invalid account key. For more information, see our Azure Cosmos DB for NoSQL Setup Guide.