nopSolutions/nopCommerce · error · Exception
Active exchange rate provider cannot be loaded
Error message
Active exchange rate provider cannot be loaded
What it means
Thrown by GetCurrencyLiveRatesAsync as a plain Exception (not NopException) when _exchangeRatePluginManager.LoadPrimaryPluginAsync() returns null — i.e., no active exchange-rate plugin is installed and selected. Live exchange-rate fetching requires an exchange-rate provider plugin.
Source
Thrown at src/Libraries/Nop.Services/Directory/CurrencyService.cs:148
await _currencyRepository.UpdateAsync(currency);
}
#endregion
#region Conversions
/// <summary>
/// Gets live rates regarding the passed currency
/// </summary>
/// <param name="currencyCode">Currency code; pass null to use primary exchange rate currency</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains the exchange rates
/// </returns>
public virtual async Task<IList<ExchangeRate>> GetCurrencyLiveRatesAsync(string currencyCode = null)
{
var exchangeRateProvider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync()
?? throw new Exception("Active exchange rate provider cannot be loaded");
currencyCode ??= (await GetCurrencyByIdAsync(_currencySettings.PrimaryExchangeRateCurrencyId))?.CurrencyCode
?? throw new NopException("Primary exchange rate currency is not set");
return await exchangeRateProvider.GetCurrencyLiveRatesAsync(currencyCode);
}
/// <summary>
/// Converts currency
/// </summary>
/// <param name="amount">Amount</param>
/// <param name="exchangeRate">Currency exchange rate</param>
/// <returns>Converted value</returns>
public virtual decimal ConvertCurrency(decimal amount, decimal exchangeRate)
{
if (amount != decimal.Zero && exchangeRate != decimal.Zero)
return amount * exchangeRate;
View on GitHub (pinned to 64bdf2ff08)
Solutions
- Install and activate an exchange-rate plugin (e.g., the built-in ECB exchange rate provider) under Admin > Configuration > Plugins.
- Set the active primary exchange rate provider in Admin > Configuration > Currencies.
- Guard callers: check that a provider is configured before triggering a live-rate refresh; fall back to manual rates.
- Verify the plugin record's IsActive and that LoadPrimaryPluginAsync returns non-null in the current environment.
Example fix
// before
var rates = await _currencyService.GetCurrencyLiveRatesAsync();
// after
var provider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync();
if (provider is null)
{
_logger.LogWarning("No active exchange rate provider; skipping live rates.");
return Array.Empty<ExchangeRate>();
}
var rates = await _currencyService.GetCurrencyLiveRatesAsync(); Defensive patterns
Strategy: validation
Validate before calling
var provider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync();
if (provider is null)
return Array.Empty<ExchangeRate>(); // or warn
var rates = await _currencyService.GetCurrencyLiveRatesAsync(); Try / catch
try { return await _currencyService.GetCurrencyLiveRatesAsync(code); }
catch (Exception ex) when (ex.Message.Contains("exchange rate provider cannot be loaded"))
{ _logger.LogWarning(ex, "No exchange rate provider; returning empty."); return Array.Empty<ExchangeRate>(); } Prevention
- Install and activate an exchange-rate plugin before offering live-rate features.
- Set the primary provider in Admin > Configuration > Currencies.
- Fall back to manual rates when no provider is configured.
When it happens
Trigger: Calling GetCurrencyLiveRatesAsync when no exchange-rate plugin is installed, none is active, or the configured primary plugin failed to load/activate.
Common situations: Default install with no exchange-rate plugin configured; admin disabled the provider; a plugin dependency (e.g., ECB feed) is missing; LocalPlugins cache lists no active exchange-rate plugin.
Related errors
- Primary exchange rate currency is not set
- Primary exchange rate currency cannot be loaded
- Exchange rate not found for currency [{sourceCurrencyCode.Na
- Exchange rate not found for currency [{targetCurrencyCode.Na
- Payment method couldn't be loaded
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/b2a04d251a74c706.
Report an issue: GitHub.