diff --git a/core/includes/utility.inc b/core/includes/utility.inc
index 135ab2473c18858c85c8e0d81f4334ab5fff0539..3192debd1c2464b53ad0c019c7a47afba4b40bb7 100644
--- a/core/includes/utility.inc
+++ b/core/includes/utility.inc
@@ -55,6 +55,7 @@ function drupal_rebuild(ClassLoader $classloader, Request $request) {
 
   // Bootstrap up to where caches exist and clear them.
   $kernel = new DrupalKernel('prod', $classloader);
+  $kernel->setSitePath(DrupalKernel::findSitePath($request));
   $kernel->prepareLegacyRequest($request);
 
   foreach (Cache::getBins() as $bin) {