diff --git chrome/browser/optimization_guide/optimization_guide_keyed_service.cc chrome/browser/optimization_guide/optimization_guide_keyed_service.cc index bd928f4422f99..f0124ab225b6f 100644 --- chrome/browser/optimization_guide/optimization_guide_keyed_service.cc +++ chrome/browser/optimization_guide/optimization_guide_keyed_service.cc @@ -269,7 +269,7 @@ void OptimizationGuideKeyedService::Initialize() { MaybeCreatePushNotificationManager(profile), optimization_guide_logger_.get()); base::FilePath model_downloads_dir; - if (!profile->IsOffTheRecord()) { + if (!profile->IsOffTheRecord() && !profile_path.empty()) { // Do not explicitly hand off the model downloads directory to // off-the-record profiles. Underneath the hood, this variable is only used // in non off-the-record profiles to know where to download the model files @@ -281,7 +281,7 @@ void OptimizationGuideKeyedService::Initialize() { prediction_manager_ = std::make_unique( prediction_model_and_features_store, url_loader_factory, - profile->GetPrefs(), profile->IsOffTheRecord(), + profile->GetPrefs(), /*is_off_the_record=*/model_downloads_dir.empty(), g_browser_process->GetApplicationLocale(), model_downloads_dir, optimization_guide_logger_.get(), base::BindOnce(