nopSolutions/nopCommerce · error · NopException
Address is incomplete
Error message
Address is incomplete
What it means
For US and Canadian addresses (country US or CA) Avalara requires a postal code; if absent, a full street+city+region is accepted. CheckAddressDetails throws when country is US/CA, postalCode is empty, AND at least one of line1, city, or region is also empty - the jurisdiction cannot be resolved reliably.
Source
Thrown at src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs:733
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");
}
#endregion
#region Certificates
/// <summary>
/// Create or update the passed customer for the company
/// </summary>
/// <param name="customer">Customer</param>
/// <param name="companyId">Selected company id</param>
/// <param name="customerExists">Whether the customer is already created</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains the customer details
/// </returns>
protected async Task<CustomerModel> CreateOrUpdateCustomerAsync(Customer customer, int companyId, bool customerExists)
{View on GitHub (pinned to 64bdf2ff08)
Solutions
- Require postal code for US/CA countries on the address form.
- If ZIP is unavailable, ensure line1, city, and region are all populated.
- Validate address completeness in nopCommerce before submitting to Avalara.
- Confirm the StateProvince to region mapping is not empty.
Example fix
// before
if (!string.IsNullOrEmpty(address.line1) && !string.IsNullOrEmpty(address.city) && !string.IsNullOrEmpty(address.region))
return;
throw new NopException("Address is incomplete");
// after - report the missing fields
var missing = new List<string>();
if (string.IsNullOrEmpty(address.line1)) missing.Add("street");
if (string.IsNullOrEmpty(address.city)) missing.Add("city");
if (string.IsNullOrEmpty(address.region)) missing.Add("state/region");
throw new NopException($"Address is incomplete: a US/CA address needs a postal code or all of street, city, and state. Missing: {string.Join(", ", missing)}"); Defensive patterns
Strategy: validation
Validate before calling
// Pre-validate US/CA address completeness
static bool IsAddressComplete(AddressLocationInfo a)
{
if (a is null) return false;
var isUsCa = string.Equals(a.country, "US", StringComparison.OrdinalIgnoreCase)
|| string.Equals(a.country, "CA", StringComparison.OrdinalIgnoreCase);
if (!isUsCa) return true;
return !string.IsNullOrEmpty(a.postalCode)
|| (!string.IsNullOrEmpty(a.line1) && !string.IsNullOrEmpty(a.city) && !string.IsNullOrEmpty(a.region));
}
if (!IsAddressComplete(address))
throw new NopException("US/CA address is incomplete"); Type guard
static bool IsAddressComplete(AddressLocationInfo a)
{
if (a is null) return false;
var isUsCa = string.Equals(a.country, "US", StringComparison.OrdinalIgnoreCase)
|| string.Equals(a.country, "CA", StringComparison.OrdinalIgnoreCase);
if (!isUsCa) return true;
return !string.IsNullOrEmpty(a.postalCode)
|| (!string.IsNullOrEmpty(a.line1) && !string.IsNullOrEmpty(a.city) && !string.IsNullOrEmpty(a.region));
} Prevention
- Require postal code for US/CA on the address form.
- Map nopCommerce StateProvince to the region field reliably.
- Validate address completeness before submitting to Avalara.
- Reject or prompt for completion when ZIP is missing for US/CA.
When it happens
Trigger: Country equals US or CA (case-insensitive), postalCode is null/empty, and the address lacks a complete line1 + city + region triple. International (non-US/CA) addresses skip this check entirely.
Common situations: Customer entered a US address without a ZIP code; the address form does not require postal code; region/state was not mapped from the nopCommerce StateProvince; guest checkout with partial address data; ZIP stripped by a sanitizer.
Related errors
- Address not set
- {aggregated error summaries}
- Item HS classification error: {error}
- {ModelState errors joined by ', '}
- Checkout.Address.NotFound
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/fe1499338e56091c.
Report an issue: GitHub.