{"record":{"id":"87c609073f1a64d8","repo":"nopSolutions/nopCommerce","slug":"file-avalarataxdefaults-taxratesfilepath-not-fou","errorCode":null,"errorMessage":"File {AvalaraTaxDefaults.TaxRatesFilePath} not found","messagePattern":"File (.+?) not found","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"warning","filePath":"src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs","lineNumber":668,"sourceCode":"        return model;\n    }\n\n    /// <summary>\n    /// Get tax rates from the file\n    /// </summary>\n    /// <returns>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the tax rates list\n    /// </returns>\n    protected async Task<List<TaxRate>> GetTaxRatesFromFileAsync()\n    {\n        //try to create file if doesn't exist\n        var filePath = _fileProvider.MapPath(AvalaraTaxDefaults.TaxRatesFilePath);\n        if (!_fileProvider.FileExists(filePath))\n            await DownloadTaxRatesAsync();\n\n        if (!_fileProvider.FileExists(filePath))\n            throw new NopException($\"File {AvalaraTaxDefaults.TaxRatesFilePath} not found\");\n\n        //get file lines\n        var text = await _fileProvider.ReadAllTextAsync(filePath, Encoding.UTF8);\n        if (string.IsNullOrEmpty(text))\n            throw new NopException($\"File {AvalaraTaxDefaults.TaxRatesFilePath} is empty\");\n\n        var lines = text.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);\n        if (!lines.Any() || lines[0].Split(',').Length < 14)\n            throw new NopException($\"Unsupported file {AvalaraTaxDefaults.TaxRatesFilePath} structure\");\n\n        //prepare tax rates\n        var taxRates = lines.Skip(1).Select(line =>\n        {\n            try\n            {\n                var values = line.Split(',', StringSplitOptions.TrimEntries);\n                return new TaxRate\n                {","sourceCodeStart":650,"sourceCodeEnd":686,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs#L650-L686","documentation":"GetTaxRatesFromFileAsync is the offline fallback that reads a local CSV of US tax rates. It first tries DownloadTaxRatesAsync, then re-checks existence; if the file is still missing it throws. This path is used for the rate-by-ZIP lookup, separate from live transaction calls.","triggerScenarios":"DownloadTaxRatesAsync failed (network error, invalid credentials, or an empty response) and left no file behind, or the configured TaxRatesFilePath maps to a directory that does not exist or is not writable.","commonSituations":"First run with no internet or invalid Avalara credentials; file-system permissions prevent writing under App_Data; TaxRatesFilePath misconfigured to a non-existent folder; disk full; antivirus quarantining the new file.","solutions":["Verify Avalara credentials and network connectivity, then trigger a re-download from the admin area.","Confirm the directory mapped by TaxRatesFilePath exists and the application identity has write permission.","Check available disk space on the volume holding App_Data.","Manually delete any partial file and re-run the download."],"exampleFix":"// before\nif (!_fileProvider.FileExists(filePath))\n    await DownloadTaxRatesAsync();\nif (!_fileProvider.FileExists(filePath))\n    throw new NopException($\"File {AvalaraTaxDefaults.TaxRatesFilePath} not found\");\n\n// after - name the cause and the directory to check\nif (!_fileProvider.FileExists(filePath))\n    await DownloadTaxRatesAsync();\nif (!_fileProvider.FileExists(filePath))\n    throw new NopException($\"Tax rates file {AvalaraTaxDefaults.TaxRatesFilePath} not found; download failed - verify Avalara credentials and write access to {_fileProvider.GetDirectoryName(filePath)}\");","handlingStrategy":"validation","validationCode":"// Verify directory and downloadability before relying on the file\nvar filePath = _fileProvider.MapPath(AvalaraTaxDefaults.TaxRatesFilePath);\nvar dir = _fileProvider.GetDirectoryName(filePath);\nif (!_fileProvider.DirectoryExists(dir))\n    _fileProvider.CreateDirectory(dir);\nif (!_fileProvider.FileExists(filePath))\n    await DownloadTaxRatesAsync();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure the App_Data directory (and the TaxRatesFilePath folder) is writable by the app identity.","Run a manual rate-file download after install to confirm it succeeds.","Monitor disk space on the volume holding App_Data.","Exclude the rates-file path from antivirus/proxy inspection."],"tags":["avalara","tax-rates","file","fallback"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}