nopSolutions/nopCommerce · error · NopException

Address not set

Error message

Address not set

What it means

CheckAddressDetails is the precondition guard before building a transaction. It throws when the passed AddressLocationInfo is null, because Avalara cannot determine a tax jurisdiction without any address at all.

Source

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

                };
            }
            catch
            {
                return null;
            }
        }).Where(taxRate => taxRate is not null).ToList();

        return taxRates;
    }

    /// <summary>
    /// Check address details before creating a transaction
    /// </summary>
    /// <param name="address">Address to check</param>
    protected void CheckAddressDetails(AddressLocationInfo address)
    {
        if (address is null)
            throw new NopException("Address not set");

        //for international transactions, the two digit ISO country code is required to determine tax jurisdictions
        if (!string.IsNullOrEmpty(address.country) &&
            !string.Equals(address.country, "US", StringComparison.InvariantCultureIgnoreCase) &&
            !string.Equals(address.country, "CA", StringComparison.InvariantCultureIgnoreCase))
        {
            return;
        }

        //for US and Canadian addresses a postal code is required
        if (!string.IsNullOrEmpty(address.postalCode))
            return;

        //however a full address (street address, city, state, and zip code) will return the best tax calculation
        if (!string.IsNullOrEmpty(address.line1) && !string.IsNullOrEmpty(address.city) && !string.IsNullOrEmpty(address.region))
            return;

        throw new NopException("Address is incomplete");

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Ensure an address is resolved (shipping, billing, or configured origin) before invoking the tax flow.
  2. Fix the Address to AddressLocationInfo mapping so it never returns null for a valid address.
  3. Configure a default tax-origin address in tax settings as a last resort.

Example fix

// before
if (address is null)
    throw new NopException("Address not set");

// after - fail with context at the guard
address ?? throw new NopException("Address not set (no shipping/billing/origin address resolved for this order)");
Defensive patterns

Strategy: validation

Validate before calling

// Resolve a non-null address before entering the tax flow
var addressInfo = MapToAddressLocationInfo(address)
    ?? throw new NopException("No address resolved for this order");
CheckAddressDetails(addressInfo);

Type guard

static bool IsAddressLocationInfoUsable(AddressLocationInfo a) => a is not null;

Prevention

When it happens

Trigger: A code path called the tax-calculation flow with a null AddressLocationInfo - for example tax estimation with no resolved customer address, or an Address-to-AddressLocationInfo mapping that returned null.

Common situations: Customer has no default address and the cart has no shipping/billing address; the nopCommerce Address to AddressLocationInfo mapping failed; a pickup-only or no-shipping scenario lacking an origin address; a refactoring that dropped the address argument.

Related errors


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