An Azure NoSQL database service for app development.
The primary cause is that the VS Code extension cannot find the Azure Cosmos DB Shell executable:
-
spawnSync cosmosdbshell ENOENT -
while running "cosmosdbshell --version"
ENOENT indicates the cosmosdbshell command is not available to the extension. When the shell is missing or not discoverable, the extension can fail to initialize correctly, which can then lead to follow-on errors such as failure to process the Cosmos DB resource URI and the query editor error Cannot read properties of null (reading 'trim').
Recommended checks:
- Verify the VS Code extension is installed and visible.
- Open Extensions with Ctrl+Shift+X.
- Search for Cosmos DB.
- Confirm the Azure Cosmos DB extension by Microsoft is installed.
- Verify the shell integration is available in VS Code.
- Open the Command Palette with Ctrl+Shift+P.
- Type Cosmos DB Shell.
- Confirm Cosmos DB Shell commands appear.
- Check the local shell installation.
- If installed via NuGet, run:
cosmosdbshell --version - If installed as a binary, run:
./cosmosdbshell --version - If
cosmosdbshell --versionfails with command not found, ensure .NET SDK 10.0+ is installed, restart the terminal, and verify$HOME/.dotnet/toolsis inPATH.
- If installed via NuGet, run:
- Confirm VS Code version.
- Go to Help > About.
- Verify VS Code is 1.85 or later.
- Restart and, if needed, reinstall the extension.
- Restart VS Code.
- If the extension still does not load correctly, clear the extension cache and reinstall.
- After the shell is working, retry authentication in VS Code.
- Open Command Palette.
- Run Azure: Sign Out.
- Run Azure: Sign In.
- Complete browser authentication.
- Re-select the correct subscription and resource group.
- If the resource tree is blank or the account cannot be resolved, verify the selected subscription and refresh the explorer.
- In the Cosmos DB/Azure view, confirm the correct subscription is selected.
- Press F5 or use the refresh icon.
- Verify the Cosmos DB account exists and is accessible.
The role assignment is unlikely to be the root cause here because the same account can query successfully in Azure portal Data Explorer. The logged failure points to a local VS Code extension/shell setup problem first, not a data-plane authorization problem.
References: