+ // If the site locator couldn't find a local site, and we did not
+ // redispatch to a site-local Drush, then we cannot continue.
+ // This can happen when using Drush 9 to call a site-local Drush 8
+ // using an alias record that is only defined in a Drush 8 format.
+ if (!$selfAliasRecord) {
+ // Note that PreflightSiteLocator::findSite only returns 'false'
+ // when preflightArgs->alias() returns an alias name. In all other
+ // instances we will get an alias record, even if it is only a
+ // placeholder 'self' with the root holding the cwd.
+ $aliasName = $this->preflightArgs->alias();
+ throw new \Exception("The alias $aliasName could not be found.");
+ }
+