nopSolutions/nopCommerce · warning · NopException

File {AvalaraTaxDefaults.TaxRatesFilePath} not found

Error message

File {AvalaraTaxDefaults.TaxRatesFilePath} not found

What it means

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.

Source

Thrown at src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs:668

        return model;
    }

    /// <summary>
    /// Get tax rates from the file
    /// </summary>
    /// <returns>
    /// A task that represents the asynchronous operation
    /// The task result contains the tax rates list
    /// </returns>
    protected async Task<List<TaxRate>> GetTaxRatesFromFileAsync()
    {
        //try to create file if doesn't exist
        var filePath = _fileProvider.MapPath(AvalaraTaxDefaults.TaxRatesFilePath);
        if (!_fileProvider.FileExists(filePath))
            await DownloadTaxRatesAsync();

        if (!_fileProvider.FileExists(filePath))
            throw new NopException($"File {AvalaraTaxDefaults.TaxRatesFilePath} not found");

        //get file lines
        var text = await _fileProvider.ReadAllTextAsync(filePath, Encoding.UTF8);
        if (string.IsNullOrEmpty(text))
            throw new NopException($"File {AvalaraTaxDefaults.TaxRatesFilePath} is empty");

        var lines = text.Split(Environment.NewLine, StringSplitOptions.RemoveEmptyEntries);
        if (!lines.Any() || lines[0].Split(',').Length < 14)
            throw new NopException($"Unsupported file {AvalaraTaxDefaults.TaxRatesFilePath} structure");

        //prepare tax rates
        var taxRates = lines.Skip(1).Select(line =>
        {
            try
            {
                var values = line.Split(',', StringSplitOptions.TrimEntries);
                return new TaxRate
                {

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Verify Avalara credentials and network connectivity, then trigger a re-download from the admin area.
  2. Confirm the directory mapped by TaxRatesFilePath exists and the application identity has write permission.
  3. Check available disk space on the volume holding App_Data.
  4. Manually delete any partial file and re-run the download.

Example fix

// before
if (!_fileProvider.FileExists(filePath))
    await DownloadTaxRatesAsync();
if (!_fileProvider.FileExists(filePath))
    throw new NopException($"File {AvalaraTaxDefaults.TaxRatesFilePath} not found");

// after - name the cause and the directory to check
if (!_fileProvider.FileExists(filePath))
    await DownloadTaxRatesAsync();
if (!_fileProvider.FileExists(filePath))
    throw new NopException($"Tax rates file {AvalaraTaxDefaults.TaxRatesFilePath} not found; download failed - verify Avalara credentials and write access to {_fileProvider.GetDirectoryName(filePath)}");
Defensive patterns

Strategy: validation

Validate before calling

// Verify directory and downloadability before relying on the file
var filePath = _fileProvider.MapPath(AvalaraTaxDefaults.TaxRatesFilePath);
var dir = _fileProvider.GetDirectoryName(filePath);
if (!_fileProvider.DirectoryExists(dir))
    _fileProvider.CreateDirectory(dir);
if (!_fileProvider.FileExists(filePath))
    await DownloadTaxRatesAsync();

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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