{"record":{"id":"0538bfa076f309fa","repo":"nopSolutions/nopCommerce","slug":"plugins-exchangerate-ecbexchange-error","errorCode":null,"errorMessage":"Plugins.ExchangeRate.EcbExchange.Error","messagePattern":"Plugins\\.ExchangeRate\\.EcbExchange\\.Error","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.ExchangeRate.EcbExchange/EcbExchangeRateProvider.cs","lineNumber":111,"sourceCode":"                {\n                    CurrencyCode = currency.Attributes[\"currency\"].Value,\n                    Rate = currencyRate,\n                    UpdatedOn = updateDate\n                });\n            }\n        }\n        catch (Exception ex)\n        {\n            await _logger.ErrorAsync(\"ECB exchange rate provider\", ex);\n        }\n\n        //return result for the euro\n        if (exchangeRateCurrencyCode.Equals(\"eur\", StringComparison.InvariantCultureIgnoreCase))\n            return ratesToEuro;\n\n        //use only currencies that are supported by ECB\n        var exchangeRateCurrency = ratesToEuro.FirstOrDefault(rate => rate.CurrencyCode.Equals(exchangeRateCurrencyCode, StringComparison.InvariantCultureIgnoreCase)) \n                                   ?? throw new NopException(await _localizationService.GetResourceAsync(\"Plugins.ExchangeRate.EcbExchange.Error\"));\n\n        //return result for the selected (not euro) currency\n        return ratesToEuro.Select(rate => new Core.Domain.Directory.ExchangeRate\n        {\n            CurrencyCode = rate.CurrencyCode,\n            Rate = Math.Round(rate.Rate / exchangeRateCurrency.Rate, 4),\n            UpdatedOn = rate.UpdatedOn\n        }).ToList();\n    }\n\n    /// <summary>\n    /// Install the plugin\n    /// </summary>\n    /// <returns>A task that represents the asynchronous operation</returns>\n    public override async Task InstallAsync()\n    {\n        //settings\n        var defaultSettings = new EcbExchangeRateSettings","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.ExchangeRate.EcbExchange/EcbExchangeRateProvider.cs#L93-L129","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the store's primary currency to a currency that ECB publishes (EUR, USD, GBP, JPY, etc.), or accept EUR.","Fix the ECB link in EcbExchangeRateSettings.EcbLink if it is outdated; verify the URL returns the expected XML.","Check the log for the 'ECB exchange rate provider' error to confirm whether the download failed (then fix connectivity).","If you need non-ECB currencies, use a different exchange-rate provider plugin."],"exampleFix":"// before: primary store currency = 'ZAR' not reliably in feed, or download failed\n// after: set primary currency to a published code, e.g. in admin:\n//   Configuration > Currencies > mark 'EUR' or 'USD' as primary\n// and verify ECB link returns 200 XML","handlingStrategy":"fallback","validationCode":"if (!ratesToEuro.Any(r => r.CurrencyCode.Equals(code, StringComparison.OrdinalIgnoreCase)))\n    // use a fallback provider or default rate, do not throw","typeGuard":"static bool IsSupportedByEcb(IList<ExchangeRate> rates, string code)\n    => rates.Any(r => r.CurrencyCode.Equals(code, StringComparison.OrdinalIgnoreCase));","tryCatchPattern":"try { return await _ecbProvider.GetCurrencyLiveRatesAsync(primaryCode); }\ncatch (NopException ex) { logger.Error(\"ECB rate unavailable for \" + primaryCode, ex); return Enumerable.Empty<ExchangeRate>(); }","preventionTips":["Set the primary currency to an ECB-published code.","Monitor the 'ECB exchange rate provider' log entry to detect download failures early.","Use a fallback provider for non-ECB currencies."],"tags":["exchange-rates","plugins","currency","network","config"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}