nopSolutions/nopCommerce · critical · NopException

UPS shipping service. Could not load 'lb' measure weight (us

Error message

UPS shipping service. Could not load 'lb' measure weight (used to find limits)

What it means

Thrown at the start of GetRatesAsync when the 'lb' (pound) measure weight cannot be loaded from the nopCommerce measure system. This is separate from the configured WeightType lookup — 'lb' is needed internally to compute UPS weight-based limits regardless of the store's configured unit. Without it, package weight limits cannot be determined.

Source

Thrown at src/Plugins/Nop.Plugin.Shipping.UPS/Services/UPSService.cs:978

        }
    }

    /// <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);

        //get rates for Saturday delivery
        if (_upsSettings.SaturdayDeliveryEnabled)

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Recreate the 'lb' measure weight at Admin > Configuration > Measures with system keyword 'lb'
  2. Verify the measure weight is active and has a valid ratio to the primary weight
  3. Run a database seed/migration script to restore default measure weights
  4. If intentionally not using pounds, note that UPS plugin requires 'lb' to exist for internal limit calculations regardless of WeightType setting

Example fix

// before
var response = await _upsService.GetRatesAsync(request);

// after — ensure required measure weights exist
var lbWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync("lb");
if (lbWeight is null)
    throw new InvalidOperationException("Measure weight 'lb' is required by UPS plugin. Restore it in Admin > Measures.");
var response = await _upsService.GetRatesAsync(request);
Defensive patterns

Strategy: validation

Validate before calling

// Verify the 'lb' measure weight exists (required by UPS for limit calculations)
var lbWeight = await _measureService.GetMeasureWeightBySystemKeywordAsync("lb");
if (lbWeight is null)
    throw new InvalidOperationException("UPS requires measure weight 'lb' for limit calculations. Restore 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("'lb'"))
{
    _logger.Error($"UPS requires 'lb' measure weight: {ex.Message}");
    return ErrorResult("Shipping rates unavailable — measure configuration required");
}

Prevention

When it happens

Trigger: GetMeasureWeightBySystemKeywordAsync('lb') returns null, meaning the 'lb' measure weight record was deleted or never created in the database. This check runs after the primary WeightType measure weight check.

Common situations: Measure weight 'lb' was manually deleted from Admin > Configuration > Measures; database was reset or migrated without seeding measure units; a European-only deployment removed imperial units; measure weight system keyword was changed from 'lb' to something else.

Related errors


AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13). Data as JSON: /api/errors/64d2317f188b05f3. Report an issue: GitHub.