nopSolutions/nopCommerce · error · NopException

Plugins.ExchangeRate.EcbExchange.Error

Error message

Plugins.ExchangeRate.EcbExchange.Error

What it means

Thrown by EcbExchangeRateProvider after fetching ECB rates: it looks up the primary store currency's rate in the rates-to-EUR list; if not found it throws NopException with the localized resource 'Plugins.ExchangeRate.EcbExchange.Error'. Note the fetch itself is wrapped in try/catch that only logs, so a network/parse failure silently leaves ratesToEuro with just EUR, which then fails this currency lookup.

Source

Thrown at src/Plugins/Nop.Plugin.ExchangeRate.EcbExchange/EcbExchangeRateProvider.cs:111

                {
                    CurrencyCode = currency.Attributes["currency"].Value,
                    Rate = currencyRate,
                    UpdatedOn = updateDate
                });
            }
        }
        catch (Exception ex)
        {
            await _logger.ErrorAsync("ECB exchange rate provider", ex);
        }

        //return result for the euro
        if (exchangeRateCurrencyCode.Equals("eur", StringComparison.InvariantCultureIgnoreCase))
            return ratesToEuro;

        //use only currencies that are supported by ECB
        var exchangeRateCurrency = ratesToEuro.FirstOrDefault(rate => rate.CurrencyCode.Equals(exchangeRateCurrencyCode, StringComparison.InvariantCultureIgnoreCase)) 
                                   ?? throw new NopException(await _localizationService.GetResourceAsync("Plugins.ExchangeRate.EcbExchange.Error"));

        //return result for the selected (not euro) currency
        return ratesToEuro.Select(rate => new Core.Domain.Directory.ExchangeRate
        {
            CurrencyCode = rate.CurrencyCode,
            Rate = Math.Round(rate.Rate / exchangeRateCurrency.Rate, 4),
            UpdatedOn = rate.UpdatedOn
        }).ToList();
    }

    /// <summary>
    /// Install the plugin
    /// </summary>
    /// <returns>A task that represents the asynchronous operation</returns>
    public override async Task InstallAsync()
    {
        //settings
        var defaultSettings = new EcbExchangeRateSettings

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Set the store's primary currency to a currency that ECB publishes (EUR, USD, GBP, JPY, etc.), or accept EUR.
  2. Fix the ECB link in EcbExchangeRateSettings.EcbLink if it is outdated; verify the URL returns the expected XML.
  3. Check the log for the 'ECB exchange rate provider' error to confirm whether the download failed (then fix connectivity).
  4. If you need non-ECB currencies, use a different exchange-rate provider plugin.

Example fix

// before: primary store currency = 'ZAR' not reliably in feed, or download failed
// after: set primary currency to a published code, e.g. in admin:
//   Configuration > Currencies > mark 'EUR' or 'USD' as primary
// and verify ECB link returns 200 XML
Defensive patterns

Strategy: fallback

Validate before calling

if (!ratesToEuro.Any(r => r.CurrencyCode.Equals(code, StringComparison.OrdinalIgnoreCase)))
    // use a fallback provider or default rate, do not throw

Type guard

static bool IsSupportedByEcb(IList<ExchangeRate> rates, string code)
    => rates.Any(r => r.CurrencyCode.Equals(code, StringComparison.OrdinalIgnoreCase));

Try / catch

try { return await _ecbProvider.GetCurrencyLiveRatesAsync(primaryCode); }
catch (NopException ex) { logger.Error("ECB rate unavailable for " + primaryCode, ex); return Enumerable.Empty<ExchangeRate>(); }

Prevention

When it happens

Trigger: The store's primary currency is not in the ECB daily feed (e.g. a currency ECB stopped publishing, or a custom/local currency code), OR the ECB download failed/changed format so only the EUR seed rate exists and the requested currency is missing from the list.

Common situations: Store primary currency set to a non-ECB currency (e.g. some African/Asian currencies not in the ECB list); the ECB XML endpoint URL is stale; network/firewall blocks the ECB fetch so the list is EUR-only; ECB changed its XML schema.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/0538bfa076f309fa. Report an issue: GitHub.