nopSolutions/nopCommerce · critical · NopException
UPS shipping service. Could not load "{weightSystemName}" me
Error message
UPS shipping service. Could not load "{weightSystemName}" measure weight What it means
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.
Source
Thrown at src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs:975
await _logger.ErrorAsync(message, exception, await _workContext.GetCurrentCustomerAsync());
return new List<ShipmentStatusEvent>();
}
}
/// <summary>
/// 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);View on GitHub (pinned to 64bdf2ff08)
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
Example fix
// before
var response = await _upsService.GetRatesAsync(request);
// after — verify measure weight exists before requesting rates
var weightKeyword = _upsSettings.WeightType switch { "LBS" => "lb", "KGS" => "kg", _ => null };
var measureWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(weightKeyword);
if (measureWeight is null)
throw new InvalidOperationException($"Measure weight '{weightKeyword}' not found. Configure it in Admin > Measures.");
var response = await _upsService.GetRatesAsync(request); Defensive patterns
Strategy: validation
Validate before calling
// Verify the configured weight measure exists before requesting rates
var weightKeyword = _upsSettings.WeightType switch { "LBS" => "lb", "KGS" => "kg", _ => null };
var measureWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync(weightKeyword);
if (measureWeight is null)
throw new InvalidOperationException($"UPS requires measure weight '{weightKeyword}'. 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 weight"))
{
_logger.Error($"UPS measure weight not found: {ex.Message}");
return ErrorResult("Shipping rates unavailable — measure configuration required");
} Prevention
- 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
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- UPS shipping service. Could not load 'lb' measure weight (us
- UPS shipping service. Could not load "{dimensionSystemName}"
- UPS shipping service. Could not load 'inches' measure dimens
- 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/97a938e240543cec.
Report an issue: GitHub.