nopSolutions/nopCommerce · critical · NopException
UPS shipping service. Could not load "{dimensionSystemName}"
Error message
UPS shipping service. Could not load "{dimensionSystemName}" measure dimension What it means
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.
Source
Thrown at src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs:982
/// Gets shipping rates
/// </summary>
/// <param name="shippingOptionRequest">Shipping option request details</param>
/// <returns>
/// A task that represents the asynchronous operation
/// The task result contains the represents a response of getting shipping rate options
/// </returns>
public virtual async Task<GetShippingOptionResponse> GetRatesAsync(GetShippingOptionRequest shippingOptionRequest)
{
var weightSystemName = _upsSettings.WeightType switch { "LBS" => "lb", "KGS" => "kg", _ => null };
_measureWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(weightSystemName)
?? throw new NopException($"UPS shipping service. Could not load \"{weightSystemName}\" measure weight");
_lbWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync("lb")
?? throw new NopException($"UPS shipping service. Could not load 'lb' measure weight (used to find limits)");
var dimensionSystemName = _upsSettings.DimensionsType switch { "IN" => "inches", "CM" => "centimeters", _ => null };
_measureDimension = await _measureService.GetMeasureDimensionBySystemKeywordAsync(dimensionSystemName)
?? throw new NopException($"UPS shipping service. Could not load \"{dimensionSystemName}\" measure dimension");
_inchesDimension = await _measureService.GetMeasureDimensionBySystemKeywordAsync("inches")
?? throw new NopException($"UPS shipping service. Could not load 'inches' measure dimension (used to find limits)");
var response = new GetShippingOptionResponse();
//get regular rates
var (shippingOptions, error) = await GetShippingOptionsAsync(shippingOptionRequest);
response.ShippingOptions = shippingOptions;
if (!string.IsNullOrEmpty(error))
response.Errors.Add(error);
//get rates for Saturday delivery
if (_upsSettings.SaturdayDeliveryEnabled)
{
var (saturdayShippingOptions, saturdayError) = await GetShippingOptionsAsync(shippingOptionRequest, true);
foreach (var shippingOption in saturdayShippingOptions)
response.ShippingOptions.Add(shippingOption);View on GitHub (pinned to 64bdf2ff08)
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
Example fix
// before
var response = await _upsService.GetRatesAsync(request);
// after — verify measure dimension exists before requesting rates
var dimKeyword = _upsSettings.DimensionsType switch { "IN" => "inches", "CM" => "centimeters", _ => null };
var measureDim = await _measureService.GetMeasureDimensionBySystemKeywordAsync(dimKeyword);
if (measureDim is null)
throw new InvalidOperationException($"Measure dimension '{dimKeyword}' not found. Configure it in Admin > Measures.");
var response = await _upsService.GetRatesAsync(request); Defensive patterns
Strategy: validation
Validate before calling
// Verify the configured dimension measure exists before requesting rates
var dimKeyword = _upsSettings.DimensionsType switch { "IN" => "inches", "CM" => "centimeters", _ => null };
var measureDim = await _measureService.GetMeasureDimensionBySystemKeywordAsync(dimKeyword);
if (measureDim is null)
throw new InvalidOperationException($"UPS requires measure dimension '{dimKeyword}'. Configure it in Admin > Configuration > Measures."); Try / catch
// UPS errors throw directly; caller must catch
try
{
var response = await _upsService.GetRatesAsync(request);
}
catch (NopException ex) when (ex.Message.Contains("measure dimension"))
{
_logger.Error($"UPS measure dimension not found: {ex.Message}");
return ErrorResult("Shipping rates unavailable — measure configuration required");
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- UPS shipping service. Could not load 'inches' measure dimens
- UPS shipping service. Could not load "{weightSystemName}" me
- UPS shipping service. Could not load 'lb' measure weight (us
- Client ID is not set
- Client secret is not set
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/bbd57ee8af913328.
Report an issue: GitHub.