nopSolutions/nopCommerce · warning · ArgumentException

No checkout attribute found with the specified id

Error message

No checkout attribute found with the specified id

What it means

Thrown by CheckoutAttributeController.ValueList (permission: CHECKOUT_ATTRIBUTES_VIEW). The value-grid datasource loads the parent checkout attribute by searchModel.CheckoutAttributeId and throws ArgumentException if missing. The parent attribute was deleted or the id is invalid.

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/CheckoutAttributeController.cs:337

        //activity log
        var activityLogFormat = await _localizationService.GetResourceAsync("ActivityLog.DeleteCheckoutAttribute");
        await _customerActivityService.InsertActivitiesAsync("DeleteCheckoutAttribute", checkoutAttributes, checkoutAttribute => string.Format(activityLogFormat, checkoutAttribute.Name));

        return Json(new { Result = true });
    }

    #endregion

    #region Checkout attribute values

    [HttpPost]
    [CheckPermission(StandardPermission.Catalog.CHECKOUT_ATTRIBUTES_VIEW)]
    public virtual async Task<IActionResult> ValueList(CheckoutAttributeValueSearchModel searchModel)
    {
        //try to get a checkout attribute with the specified id
        var checkoutAttribute = await _checkoutAttributeService.GetAttributeByIdAsync(searchModel.CheckoutAttributeId)
            ?? throw new ArgumentException("No checkout attribute found with the specified id");

        //prepare model
        var model = await _checkoutAttributeModelFactory.PrepareCheckoutAttributeValueListModelAsync(searchModel, checkoutAttribute);

        return Json(model);
    }

    [CheckPermission(StandardPermission.Catalog.CHECKOUT_ATTRIBUTES_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> ValueCreatePopup(int checkoutAttributeId)
    {
        //try to get a checkout attribute with the specified id
        var checkoutAttribute = await _checkoutAttributeService.GetAttributeByIdAsync(checkoutAttributeId);
        if (checkoutAttribute == null)
            return RedirectToAction("List");

        //prepare model
        var model = await _checkoutAttributeModelFactory
            .PrepareCheckoutAttributeValueModelAsync(new CheckoutAttributeValueModel(), checkoutAttribute, null);

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Reopen the checkout attributes list and pick a current attribute before listing its values.
  2. Return an empty value list instead of throwing when the parent attribute is missing.
  3. Verify the grid posts the correct CheckoutAttributeId after navigation.

Example fix

// before
var checkoutAttribute = await _checkoutAttributeService.GetAttributeByIdAsync(searchModel.CheckoutAttributeId)
    ?? throw new ArgumentException("No checkout attribute found with the specified id");

// after
var checkoutAttribute = await _checkoutAttributeService.GetAttributeByIdAsync(searchModel.CheckoutAttributeId);
if (checkoutAttribute == null)
    return Json(new CheckoutAttributeValueListModel());
Defensive patterns

Strategy: validation

Validate before calling

// Validate parent checkout attribute before listing values.
var attr = await _checkoutAttributeService.GetAttributeByIdAsync(searchModel.CheckoutAttributeId);
if (attr == null) return Json(new CheckoutAttributeValueListModel());

Type guard

static bool CheckoutAttributeExists(CheckoutAttribute a) => a is not null;

Try / catch

try { /* ValueList body */ }
catch (ArgumentException ex) when (ex.Message.Contains("checkout attribute"))
{
    return Json(new CheckoutAttributeValueListModel());
}

Prevention

When it happens

Trigger: POST ValueList with a CheckoutAttributeId that GetAttributeByIdAsync cannot find — parent attribute removed while its values tab was open, or a stale id.

Common situations: Concurrent attribute management; deleting a checkout attribute in one tab while its value grid is mounted in another; cached client state.

Related errors


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