{"record":{"id":"ca891b55cf53868a","repo":"nopSolutions/nopCommerce","slug":"tax-provider-is-not-configured","errorCode":null,"errorMessage":"Tax provider is not configured","messagePattern":"Tax provider is not configured","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs","lineNumber":184,"sourceCode":"    }\n\n    /// <summary>\n    /// Handle function and get result\n    /// </summary>\n    /// <typeparam name=\"TResult\">Result type</typeparam>\n    /// <param name=\"function\">Function</param>\n    /// <param name=\"logErrors\">Whether to log errors</param>\n    /// <returns>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the result; error if exists\n    /// </returns>\n    protected async Task<(TResult Result, string Error)> HandleFunctionAsync<TResult>(Func<Task<TResult>> function, bool logErrors = true)\n    {\n        try\n        {\n            //ensure that Avalara tax provider is configured\n            if (!IsConfigured())\n                throw new NopException(\"Tax provider is not configured\");\n\n            var result = await function();\n\n            return (result, default);\n        }\n        catch (Exception exception)\n        {\n            if (!logErrors)\n                return (default, exception.Message);\n\n            //compose an error message\n            var errorMessage = exception.Message;\n            if (exception is AvaTaxError avaTaxError && avaTaxError.error != null)\n            {\n                var errorInfo = avaTaxError.error.error;\n                if (errorInfo != null)\n                {\n                    errorMessage = $\"{errorInfo.code} - {errorInfo.message}{Environment.NewLine}\";","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs#L166-L202","documentation":"Thrown inside HandleFunctionAsync (the central wrapper for all AvalaraTaxManager operations) when IsConfigured returns false. This is the universal guard for every Avalara tax operation — it checks that the Avalara account credentials (Account ID, License Key, Company Code, and service URL) are present in settings. If unconfigured, no Avalara API call is attempted.","triggerScenarios":"Any AvalaraTaxManager method (tax calculation, address validation, tax code sync, commitment, etc.) is called through HandleFunctionAsync while AvalaraTaxSettings lacks required configuration fields. The wrapper catches the NopException and returns it as the Error string in the (Result, Error) tuple.","commonSituations":"Avalara plugin installed but not configured; settings were cleared or expired; sandbox-to-production migration left credentials blank; multi-store setup where the wrong store's settings are loaded; the tax provider was activated before configuration was completed.","solutions":["Configure Avalara credentials at Admin > Configuration > Tax Providers > Avalara > Configure with Account ID, License Key, Company Code, and Service URL","Verify the tax provider is marked as active in Admin > Configuration > Tax Providers","Test the connection from the configuration page to confirm credentials are valid","Ensure settings are loaded from the correct store scope in multi-store deployments"],"exampleFix":"// before\nvar (result, error) = await _avalaraTaxManager.GetTaxResultAsync(order, settings);\nif (!string.IsNullOrEmpty(error))\n    _logger.Error(error);\n\n// after — verify configuration before calling\nif (string.IsNullOrEmpty(settings.AccountId) || string.IsNullOrEmpty(settings.LicenseKey))\n{\n    _logger.Warning(\"Avalara tax provider is not configured; tax calculation skipped\");\n    // fall back to standard nopCommerce tax calculation\n    return await _fallbackTaxService.CalculateAsync(order);\n}\nvar (result, error) = await _avalaraTaxManager.GetTaxResultAsync(order, settings);","handlingStrategy":"validation","validationCode":"// Verify Avalara configuration before calling any AvalaraTaxManager method\nif (string.IsNullOrEmpty(settings.AccountId) || string.IsNullOrEmpty(settings.LicenseKey)\n    || string.IsNullOrEmpty(settings.CompanyCode))\n{\n    _logger.Warning(\"Avalara tax provider not configured; skipping tax calculation\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"// HandleFunctionAsync catches internally; check the returned error tuple\nvar (result, error) = await _avalaraTaxManager.GetTaxResultAsync(order);\nif (!string.IsNullOrEmpty(error) && error.Contains(\"not configured\"))\n{\n    _logger.Warning($\"Avalara not configured: {error}\");\n    // Fall back to standard nopCommerce tax calculation\n    result = await _fallbackTaxService.CalculateAsync(order);\n}","preventionTips":["Complete Avalara configuration before activating the tax provider","Add a startup health check that verifies Avalara credentials when the tax provider is active","Use the configuration page's test-connection feature to validate credentials before going live","In multi-store setups, ensure each store has its own Avalara configuration with the correct Company Code"],"tags":["avalara","configuration","tax-provider","plugin-settings","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}