{"record":{"id":"b2a04d251a74c706","repo":"nopSolutions/nopCommerce","slug":"active-exchange-rate-provider-cannot-be-loaded","errorCode":null,"errorMessage":"Active exchange rate provider cannot be loaded","messagePattern":"Active exchange rate provider cannot be loaded","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/Libraries/Nop.Services/Directory/CurrencyService.cs","lineNumber":148,"sourceCode":"        await _currencyRepository.UpdateAsync(currency);\r\n    }\r\n\r\n    #endregion\r\n\r\n    #region Conversions\r\n\r\n    /// <summary>\r\n    /// Gets live rates regarding the passed currency\r\n    /// </summary>\r\n    /// <param name=\"currencyCode\">Currency code; pass null to use primary exchange rate currency</param>\r\n    /// <returns>\r\n    /// A task that represents the asynchronous operation\r\n    /// The task result contains the exchange rates\r\n    /// </returns>\r\n    public virtual async Task<IList<ExchangeRate>> GetCurrencyLiveRatesAsync(string currencyCode = null)\r\n    {\r\n        var exchangeRateProvider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync()\r\n                                   ?? throw new Exception(\"Active exchange rate provider cannot be loaded\");\r\n\r\n        currencyCode ??= (await GetCurrencyByIdAsync(_currencySettings.PrimaryExchangeRateCurrencyId))?.CurrencyCode\r\n                         ?? throw new NopException(\"Primary exchange rate currency is not set\");\r\n\r\n        return await exchangeRateProvider.GetCurrencyLiveRatesAsync(currencyCode);\r\n    }\r\n\r\n    /// <summary>\r\n    /// Converts currency\r\n    /// </summary>\r\n    /// <param name=\"amount\">Amount</param>\r\n    /// <param name=\"exchangeRate\">Currency exchange rate</param>\r\n    /// <returns>Converted value</returns>\r\n    public virtual decimal ConvertCurrency(decimal amount, decimal exchangeRate)\r\n    {\r\n        if (amount != decimal.Zero && exchangeRate != decimal.Zero)\r\n            return amount * exchangeRate;\r\n\r","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Libraries/Nop.Services/Directory/CurrencyService.cs#L130-L166","documentation":"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.","triggerScenarios":"Calling GetCurrencyLiveRatesAsync when no exchange-rate plugin is installed, none is active, or the configured primary plugin failed to load/activate.","commonSituations":"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.","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."],"exampleFix":"// before\nvar rates = await _currencyService.GetCurrencyLiveRatesAsync();\n\n// after\nvar provider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync();\nif (provider is null)\n{\n    _logger.LogWarning(\"No active exchange rate provider; skipping live rates.\");\n    return Array.Empty<ExchangeRate>();\n}\nvar rates = await _currencyService.GetCurrencyLiveRatesAsync();","handlingStrategy":"validation","validationCode":"var provider = await _exchangeRatePluginManager.LoadPrimaryPluginAsync();\nif (provider is null)\n    return Array.Empty<ExchangeRate>(); // or warn\nvar rates = await _currencyService.GetCurrencyLiveRatesAsync();","typeGuard":null,"tryCatchPattern":"try { return await _currencyService.GetCurrencyLiveRatesAsync(code); }\ncatch (Exception ex) when (ex.Message.Contains(\"exchange rate provider cannot be loaded\"))\n{ _logger.LogWarning(ex, \"No exchange rate provider; returning empty.\"); return Array.Empty<ExchangeRate>(); }","preventionTips":["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."],"tags":["currency","exchange-rate","plugin","configuration"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}