{"record":{"id":"2ed7f3eff8e38e49","repo":"nopSolutions/nopCommerce","slug":"address-not-set","errorCode":null,"errorMessage":"Address not set","messagePattern":"Address not set","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"error","filePath":"src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs","lineNumber":715,"sourceCode":"                };\n            }\n            catch\n            {\n                return null;\n            }\n        }).Where(taxRate => taxRate is not null).ToList();\n\n        return taxRates;\n    }\n\n    /// <summary>\n    /// Check address details before creating a transaction\n    /// </summary>\n    /// <param name=\"address\">Address to check</param>\n    protected void CheckAddressDetails(AddressLocationInfo address)\n    {\n        if (address is null)\n            throw new NopException(\"Address not set\");\n\n        //for international transactions, the two digit ISO country code is required to determine tax jurisdictions\n        if (!string.IsNullOrEmpty(address.country) &&\n            !string.Equals(address.country, \"US\", StringComparison.InvariantCultureIgnoreCase) &&\n            !string.Equals(address.country, \"CA\", StringComparison.InvariantCultureIgnoreCase))\n        {\n            return;\n        }\n\n        //for US and Canadian addresses a postal code is required\n        if (!string.IsNullOrEmpty(address.postalCode))\n            return;\n\n        //however a full address (street address, city, state, and zip code) will return the best tax calculation\n        if (!string.IsNullOrEmpty(address.line1) && !string.IsNullOrEmpty(address.city) && !string.IsNullOrEmpty(address.region))\n            return;\n\n        throw new NopException(\"Address is incomplete\");","sourceCodeStart":697,"sourceCodeEnd":733,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Tax.Avalara/Services/AvalaraTaxManager.cs#L697-L733","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure an address is resolved (shipping, billing, or configured origin) before invoking the tax flow.","Fix the Address to AddressLocationInfo mapping so it never returns null for a valid address.","Configure a default tax-origin address in tax settings as a last resort."],"exampleFix":"// before\nif (address is null)\n    throw new NopException(\"Address not set\");\n\n// after - fail with context at the guard\naddress ?? throw new NopException(\"Address not set (no shipping/billing/origin address resolved for this order)\");","handlingStrategy":"validation","validationCode":"// Resolve a non-null address before entering the tax flow\nvar addressInfo = MapToAddressLocationInfo(address)\n    ?? throw new NopException(\"No address resolved for this order\");\nCheckAddressDetails(addressInfo);","typeGuard":"static bool IsAddressLocationInfoUsable(AddressLocationInfo a) => a is not null;","tryCatchPattern":null,"preventionTips":["Always resolve a shipping, billing, or origin address before tax calculation.","Make the Address to AddressLocationInfo mapping never return null.","Configure a default tax-origin address as a fallback.","Add a null-check at the call site, not just inside the guard."],"tags":["avalara","address","validation"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}