diff --git a/src/sql/workbench/services/connection/browser/connectionManagementService.ts b/src/sql/workbench/services/connection/browser/connectionManagementService.ts index 9ea478f992..c0a80599ed 100644 --- a/src/sql/workbench/services/connection/browser/connectionManagementService.ts +++ b/src/sql/workbench/services/connection/browser/connectionManagementService.ts @@ -1157,9 +1157,12 @@ export class ConnectionManagementService extends Disposable implements IConnecti } /** - * Replaces connection info uri with new uri. + * Replaces connection info uri with new uri. No-op if the URI does not currently have an associated connection. */ public changeConnectionUri(newUri: string, oldUri: string): void { + if (!this._connectionStatusManager.hasConnection(oldUri)) { + return; + } this._connectionStatusManager.changeConnectionUri(newUri, oldUri); if (!this._uriToProvider[oldUri]) { this._logService.error(`No provider found for old URI : '${oldUri}'`); diff --git a/src/sql/workbench/services/query/common/queryModelService.ts b/src/sql/workbench/services/query/common/queryModelService.ts index 1733ec1605..a16a0a039a 100644 --- a/src/sql/workbench/services/query/common/queryModelService.ts +++ b/src/sql/workbench/services/query/common/queryModelService.ts @@ -435,8 +435,8 @@ export class QueryModelService implements IQueryModelService { // Get existing query runner let queryRunner = this.internalGetQueryRunner(oldUri); if (!queryRunner) { - this._logService.error(`A Query and QueryRunner was not found for '${oldUri}'`); - throw new Error(nls.localize('queryModelService.noQueryFoundForUri', 'No Query found for {0}', oldUri)); + // Nothing to do if we don't have a query runner currently (no connection) + return; } else if (this._queryInfoMap.has(newUri)) { this._logService.error(`New URI '${newUri}' already has query info associated with it.`);