{"record":{"id":"97a938e240543cec","repo":"nopSolutions/nopCommerce","slug":"ups-shipping-service-could-not-load-weightsyste","errorCode":null,"errorMessage":"UPS shipping service. Could not load \"{weightSystemName}\" measure weight","messagePattern":"UPS shipping service\\. Could not load \"(.+?)\" measure weight","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs","lineNumber":975,"sourceCode":"            await _logger.ErrorAsync(message, exception, await _workContext.GetCurrentCustomerAsync());\n\n            return new List<ShipmentStatusEvent>();\n        }\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);","sourceCodeStart":957,"sourceCodeEnd":993,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs#L957-L993","documentation":"Thrown at the start of GetRatesAsync when the measure weight unit corresponding to the configured UPS WeightType cannot be found in the nopCommerce measure system. The WeightType setting maps LBS to the 'lb' keyword and KGS to 'kg'. If GetMeasureWeightBySystemKeywordAsync returns null for that keyword, rate calculation cannot convert cart weight to the UPS-required unit.","triggerScenarios":"GetRatesAsync is called; _upsSettings.WeightType is 'LBS' or 'KGS' (or an unexpected value producing null), and _measureService.GetMeasureWeightBySystemKeywordAsync returns null for the derived keyword ('lb', 'kg', or null).","commonSituations":"Fresh nopCommerce installation where measure weights 'lb' or 'kg' were not seeded or were deleted; a custom database where measure units were modified; WeightType is set to a value not in the LBS/KGS switch (producing a null keyword); measure weight system keywords were changed from their defaults.","solutions":["Go to Admin > Configuration > Measures and verify 'lb' and 'kg' measure weights exist with those exact system keywords","If missing, recreate them: Admin > Configuration > Measures > Add New Measure Weight","Verify the UPS WeightType setting is set to either 'LBS' or 'KGS' at Admin > Configuration > Shipping > UPS","Check for database corruption or incomplete data migration that may have dropped measure unit records"],"exampleFix":"// before\nvar response = await _upsService.GetRatesAsync(request);\n\n// after — verify measure weight exists before requesting rates\nvar weightKeyword = _upsSettings.WeightType switch { \"LBS\" => \"lb\", \"KGS\" => \"kg\", _ => null };\nvar measureWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(weightKeyword);\nif (measureWeight is null)\n    throw new InvalidOperationException($\"Measure weight '{weightKeyword}' not found. Configure it in Admin > Measures.\");\nvar response = await _upsService.GetRatesAsync(request);","handlingStrategy":"validation","validationCode":"// Verify the configured weight measure exists before requesting rates\nvar weightKeyword = _upsSettings.WeightType switch { \"LBS\" => \"lb\", \"KGS\" => \"kg\", _ => null };\nvar measureWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(weightKeyword);\nif (measureWeight is null)\n    throw new InvalidOperationException($\"UPS requires measure weight '{weightKeyword}'. Configure 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(\"measure weight\"))\n{\n    _logger.Error($\"UPS measure weight not found: {ex.Message}\");\n    return ErrorResult(\"Shipping rates unavailable — measure configuration required\");\n}","preventionTips":["After nopCommerce installation, verify that default measure weights 'lb' and 'kg' exist in Admin > Configuration > Measures","Run a startup validation check when the UPS plugin is active that verifies required measure units exist","Never delete the 'lb' or 'kg' measure weight records — the UPS plugin depends on them","If migrating databases, ensure measure weight records are included in the migration"],"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"}