{"record":{"id":"64d2317f188b05f3","repo":"nopSolutions/nopCommerce","slug":"ups-shipping-service-could-not-load-lb-measure","errorCode":null,"errorMessage":"UPS shipping service. Could not load 'lb' measure weight (used to find limits)","messagePattern":"UPS shipping service\\. Could not load 'lb' measure weight \\(used to find limits\\)","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs","lineNumber":978,"sourceCode":"        }\n    }\n\n    /// <summary>\n    /// Gets shipping rates\n    /// </summary>\n    /// <param name=\"shippingOptionRequest\">Shipping option request details</param>\n    /// <returns>\n    /// A task that represents the asynchronous operation\n    /// The task result contains the represents a response of getting shipping rate options\n    /// </returns>\n    public virtual async Task<GetShippingOptionResponse> GetRatesAsync(GetShippingOptionRequest shippingOptionRequest)\n    {\n        var weightSystemName = _upsSettings.WeightType switch { \"LBS\" => \"lb\", \"KGS\" => \"kg\", _ => null };\n        _measureWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(weightSystemName)\n                         ?? throw new NopException($\"UPS shipping service. Could not load \\\"{weightSystemName}\\\" measure weight\");\n\n        _lbWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(\"lb\")\n                    ?? throw new NopException($\"UPS shipping service. Could not load 'lb' measure weight (used to find limits)\");\n\n        var dimensionSystemName = _upsSettings.DimensionsType switch { \"IN\" => \"inches\", \"CM\" => \"centimeters\", _ => null };\n        _measureDimension = await _measureService.GetMeasureDimensionBySystemKeywordAsync(dimensionSystemName)\n                            ?? throw new NopException($\"UPS shipping service. Could not load \\\"{dimensionSystemName}\\\" measure dimension\");\n\n        _inchesDimension = await _measureService.GetMeasureDimensionBySystemKeywordAsync(\"inches\")\n                           ?? throw new NopException($\"UPS shipping service. Could not load 'inches' measure dimension (used to find limits)\");\n\n        var response = new GetShippingOptionResponse();\n\n        //get regular rates\n        var (shippingOptions, error) = await GetShippingOptionsAsync(shippingOptionRequest);\n        response.ShippingOptions = shippingOptions;\n        if (!string.IsNullOrEmpty(error))\n            response.Errors.Add(error);\n\n        //get rates for Saturday delivery\n        if (_upsSettings.SaturdayDeliveryEnabled)","sourceCodeStart":960,"sourceCodeEnd":996,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs#L960-L996","documentation":"Thrown at the start of GetRatesAsync when the 'lb' (pound) measure weight cannot be loaded from the nopCommerce measure system. This is separate from the configured WeightType lookup — 'lb' is needed internally to compute UPS weight-based limits regardless of the store's configured unit. Without it, package weight limits cannot be determined.","triggerScenarios":"GetMeasureWeightBySystemKeywordAsync('lb') returns null, meaning the 'lb' measure weight record was deleted or never created in the database. This check runs after the primary WeightType measure weight check.","commonSituations":"Measure weight 'lb' was manually deleted from Admin > Configuration > Measures; database was reset or migrated without seeding measure units; a European-only deployment removed imperial units; measure weight system keyword was changed from 'lb' to something else.","solutions":["Recreate the 'lb' measure weight at Admin > Configuration > Measures with system keyword 'lb'","Verify the measure weight is active and has a valid ratio to the primary weight","Run a database seed/migration script to restore default measure weights","If intentionally not using pounds, note that UPS plugin requires 'lb' to exist for internal limit calculations regardless of WeightType setting"],"exampleFix":"// before\nvar response = await _upsService.GetRatesAsync(request);\n\n// after — ensure required measure weights exist\nvar lbWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(\"lb\");\nif (lbWeight is null)\n    throw new InvalidOperationException(\"Measure weight 'lb' is required by UPS plugin. Restore it in Admin > Measures.\");\nvar response = await _upsService.GetRatesAsync(request);","handlingStrategy":"validation","validationCode":"// Verify the 'lb' measure weight exists (required by UPS for limit calculations)\nvar lbWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(\"lb\");\nif (lbWeight is null)\n    throw new InvalidOperationException(\"UPS requires measure weight 'lb' for limit calculations. Restore it in Admin > Configuration > Measures.\");","typeGuard":null,"tryCatchPattern":"// UPS errors throw directly; caller must catch\ntry\n{\n    var response = await _upsService.GetRatesAsync(request);\n}\ncatch (NopException ex) when (ex.Message.Contains(\"'lb'\"))\n{\n    _logger.Error($\"UPS requires 'lb' measure weight: {ex.Message}\");\n    return ErrorResult(\"Shipping rates unavailable — measure configuration required\");\n}","preventionTips":["The UPS plugin requires 'lb' to exist even if the store uses metric weights — do not delete it","Run a startup health check for required measure units when UPS shipping is active","Include measure weight records in any database export/import or migration","Add an admin warning when attempting to delete 'lb' or 'kg' measure weights while UPS is active"],"tags":["ups","measure-weight","configuration","shipping","data-setup","nopcommerce"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}