{"record":{"id":"bbd57ee8af913328","repo":"nopSolutions/nopCommerce","slug":"ups-shipping-service-could-not-load-dimensionsy","errorCode":null,"errorMessage":"UPS shipping service. Could not load \"{dimensionSystemName}\" measure dimension","messagePattern":"UPS shipping service\\. Could not load \"(.+?)\" measure dimension","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs","lineNumber":982,"sourceCode":"    /// 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)\n        {\n            var (saturdayShippingOptions, saturdayError) = await GetShippingOptionsAsync(shippingOptionRequest, true);\n            foreach (var shippingOption in saturdayShippingOptions)\n                response.ShippingOptions.Add(shippingOption);","sourceCodeStart":964,"sourceCodeEnd":1000,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs#L964-L1000","documentation":"Thrown at the start of GetRatesAsync when the measure dimension unit corresponding to the configured UPS DimensionsType cannot be found. DimensionsType maps 'IN' to 'inches' and 'CM' to 'centimeters'. If GetMeasureDimensionBySystemKeywordAsync returns null for the derived keyword, the service cannot convert cart item dimensions to the UPS-required unit for rate calculation.","triggerScenarios":"GetRatesAsync is called; _upsSettings.DimensionsType is 'IN' or 'CM' (or an unexpected value), and the measure dimension lookup for the derived keyword ('inches', 'centimeters', or null) returns null.","commonSituations":"Measure dimensions 'inches' or 'centimeters' were deleted from the database; DimensionsType is set to an unexpected value outside the IN/CM switch; database migration left measure dimension records incomplete; system keywords were customized away from defaults.","solutions":["Go to Admin > Configuration > Measures and verify 'inches' and 'centimeters' measure dimensions exist with those exact system keywords","If missing, recreate them: Admin > Configuration > Measures > Add New Measure Dimension","Verify the UPS DimensionsType setting is either 'IN' or 'CM' at Admin > Configuration > Shipping > UPS","Run the nopCommerce measure seed data to restore default dimension records"],"exampleFix":"// before\nvar response = await _upsService.GetRatesAsync(request);\n\n// after — verify measure dimension exists before requesting rates\nvar dimKeyword = _upsSettings.DimensionsType switch { \"IN\" => \"inches\", \"CM\" => \"centimeters\", _ => null };\nvar measureDim = await _measureService.GetMeasureDimensionBySystemKeywordAsync(dimKeyword);\nif (measureDim is null)\n    throw new InvalidOperationException($\"Measure dimension '{dimKeyword}' not found. Configure it in Admin > Measures.\");\nvar response = await _upsService.GetRatesAsync(request);","handlingStrategy":"validation","validationCode":"// Verify the configured dimension measure exists before requesting rates\nvar dimKeyword = _upsSettings.DimensionsType switch { \"IN\" => \"inches\", \"CM\" => \"centimeters\", _ => null };\nvar measureDim = await _measureService.GetMeasureDimensionBySystemKeywordAsync(dimKeyword);\nif (measureDim is null)\n    throw new InvalidOperationException($\"UPS requires measure dimension '{dimKeyword}'. 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 dimension\"))\n{\n    _logger.Error($\"UPS measure dimension not found: {ex.Message}\");\n    return ErrorResult(\"Shipping rates unavailable — measure configuration required\");\n}","preventionTips":["After nopCommerce installation, verify that default measure dimensions 'inches' and 'centimeters' exist","Run a startup validation check when the UPS plugin is active that verifies required measure dimensions exist","Never delete the 'inches' or 'centimeters' measure dimension records — the UPS plugin depends on them","Ensure the UPS DimensionsType setting is set to either 'IN' or 'CM', not a custom value"],"tags":["ups","measure-dimension","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"}