diff --git a/src/sql/workbench/services/objectExplorer/browser/asyncServerTree.ts b/src/sql/workbench/services/objectExplorer/browser/asyncServerTree.ts index 0a77592a97..3629e236c4 100644 --- a/src/sql/workbench/services/objectExplorer/browser/asyncServerTree.ts +++ b/src/sql/workbench/services/objectExplorer/browser/asyncServerTree.ts @@ -106,7 +106,9 @@ export class AsyncServerTree extends WorkbenchAsyncDataTree 0) { const node = stack.pop(); if (node) { - if (!this.isCollapsed(node.element)) { + // The root of the tree is a special case connection group that is always expanded. It is not rendered + // and this.isCollapsed returns an error when called on it. So we need to check for it explicitly. + if (node === this.root || !this.isCollapsed(node.element)) { expanded.push(node.element); if (node.children) { node.children.forEach(child => stack.push(child));