nopSolutions/nopCommerce · error · ArgumentException

No specification attribute group found with the specified id

Error message

No specification attribute group found with the specified id

What it means

Thrown by SpecificationAttributeController.SpecificationAttributeList when the search model's SpecificationAttributeGroupId is greater than zero but GetSpecificationAttributeGroupByIdAsync returns null. This AJAX grid endpoint lists specification attributes, optionally scoped to a group; a missing group is treated as an invalid request and aborted with ArgumentException. The guard only fires when a group id is actually supplied (id <= 0 means 'all groups').

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/SpecificationAttributeController.cs:126

    [HttpPost]
    [CheckPermission(StandardPermission.Catalog.SPECIFICATION_ATTRIBUTES_VIEW)]
    public virtual async Task<IActionResult> SpecificationAttributeGroupList(SpecificationAttributeSearchModel searchModel)
    {
        var model = await _specificationAttributeModelFactory.PrepareSpecificationAttributeGroupListModelAsync(searchModel);

        return Json(model);
    }

    [HttpPost]
    [CheckPermission(StandardPermission.Catalog.SPECIFICATION_ATTRIBUTES_VIEW)]
    public virtual async Task<IActionResult> SpecificationAttributeList(SpecificationAttributeSearchModel searchModel)
    {
        SpecificationAttributeGroup group = null;

        if (searchModel.SpecificationAttributeGroupId > 0)
        {
            group = await _specificationAttributeService.GetSpecificationAttributeGroupByIdAsync(searchModel.SpecificationAttributeGroupId)
                ?? throw new ArgumentException("No specification attribute group found with the specified id");
        }

        var model = await _specificationAttributeModelFactory.PrepareSpecificationAttributeListModelAsync(searchModel, group);

        return Json(model);
    }

    [CheckPermission(StandardPermission.Catalog.SPECIFICATION_ATTRIBUTES_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> CreateSpecificationAttributeGroup()
    {
        var model = await _specificationAttributeModelFactory.PrepareSpecificationAttributeGroupModelAsync(new SpecificationAttributeGroupModel(), null);

        return View(model);
    }

    [HttpPost, ParameterBasedOnFormName("save-continue", "continueEditing")]
    [CheckPermission(StandardPermission.Catalog.SPECIFICATION_ATTRIBUTES_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> CreateSpecificationAttributeGroup(SpecificationAttributeGroupModel model, bool continueEditing)

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Clear the specification-attribute-group filter or reload the page so the dropdown no longer references the deleted group.
  2. Verify the group still exists in the specification attribute groups list; if not, the filter is stale and the error is expected.
  3. For custom integrations, check the group id against the current groups before posting the search model, and fall back to an unfiltered list if it is gone.
  4. Wrap the action in a try-catch returning a localized empty-grid result instead of a 500.

Example fix

// before
group = await _specificationAttributeService.GetSpecificationAttributeGroupByIdAsync(searchModel.SpecificationAttributeGroupId)
    ?? throw new ArgumentException("No specification attribute group found with the specified id");

// after
group = await _specificationAttributeService.GetSpecificationAttributeGroupByIdAsync(searchModel.SpecificationAttributeGroupId);
if (group is null)
    searchModel.SpecificationAttributeGroupId = 0; // fall back to unfiltered
Defensive patterns

Strategy: validation

Validate before calling

if (searchModel.SpecificationAttributeGroupId > 0)
{
    var group = await _specificationAttributeService
        .GetSpecificationAttributeGroupByIdAsync(searchModel.SpecificationAttributeGroupId);
    if (group is null)
        searchModel.SpecificationAttributeGroupId = 0; // unscoped fallback
}

Try / catch

try { await controller.SpecificationAttributeList(searchModel); }
catch (ArgumentException ex) when (ex.Message.Contains("No specification attribute group"))
{ /* stale group filter — clear filter and retry unscoped */ }

Prevention

When it happens

Trigger: The specification-attributes grid is filtered by a group that was deleted in another session between the filter dropdown load and the grid data request. Also triggered by a hand-crafted POST with a stale group id, or by navigating back to a cached page whose filter references a removed group.

Common situations: An admin deletes a specification attribute group in one tab, then returns to another tab whose attribute list is still filtered to that group and triggers a rebind/reload. A plugin modifies group ids during import/migration, invalidating cached grid URLs.

Related errors


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