{"record":{"id":"4b90236159f50a46","repo":"nopSolutions/nopCommerce","slug":"ups-shipping-service-could-not-load-inches-meas","errorCode":null,"errorMessage":"UPS shipping service. Could not load 'inches' measure dimension (used to find limits)","messagePattern":"UPS shipping service\\. Could not load 'inches' measure dimension \\(used to find limits\\)","errorType":"exception","errorClass":"NopException","httpStatus":null,"severity":"critical","filePath":"src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs","lineNumber":985,"sourceCode":"    /// <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);\n            if (!string.IsNullOrEmpty(saturdayError))\n                response.Errors.Add(saturdayError);\n        }","sourceCodeStart":967,"sourceCodeEnd":1003,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs#L967-L1003","documentation":"Thrown at the start of GetRatesAsync when the 'inches' measure dimension cannot be loaded. This is required internally by the UPS plugin to compute package size limits regardless of the configured DimensionsType. Without it, dimensional limits for UPS rate calculation are unavailable.","triggerScenarios":"GetMeasureDimensionBySystemKeywordAsync('inches') returns null, meaning the 'inches' measure dimension record was deleted or never created. This check runs after the primary DimensionsType dimension check.","commonSituations":"Measure dimension 'inches' was manually deleted; a metric-only deployment removed imperial dimension records; database was reset without re-seeding measure data; system keyword was changed from 'inches' to a custom value.","solutions":["Recreate the 'inches' measure dimension at Admin > Configuration > Measures with system keyword 'inches'","Verify the measure dimension is active with a valid ratio to the primary dimension","Run nopCommerce database seed to restore default measure dimension records","Note: the UPS plugin requires 'inches' to exist for internal size limit calculations even if DimensionsType is set to 'CM'"],"exampleFix":"// before\nvar response = await _upsService.GetRatesAsync(request);\n\n// after — ensure required dimension exists\nvar inchesDim = await _measureService.GetMeasureDimensionBySystemKeywordAsync(\"inches\");\nif (inchesDim is null)\n    throw new InvalidOperationException(\"Measure dimension 'inches' is required by UPS plugin. Restore it in Admin > Measures.\");\nvar response = await _upsService.GetRatesAsync(request);","handlingStrategy":"validation","validationCode":"// Verify the 'inches' measure dimension exists (required by UPS for limit calculations)\nvar inchesDim = await _measureService.GetMeasureDimensionBySystemKeywordAsync(\"inches\");\nif (inchesDim is null)\n    throw new InvalidOperationException(\"UPS requires measure dimension 'inches' 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(\"'inches'\"))\n{\n    _logger.Error($\"UPS requires 'inches' measure dimension: {ex.Message}\");\n    return ErrorResult(\"Shipping rates unavailable — measure configuration required\");\n}","preventionTips":["The UPS plugin requires 'inches' to exist even if the store uses centimeters — do not delete it","Run a startup health check for required measure dimensions when UPS shipping is active","Include measure dimension records in any database export/import or migration","Add an admin warning when attempting to delete 'inches' while the UPS plugin is active"],"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"}