nopSolutions/nopCommerce · error · ArgumentException

No tier price found with the specified id

Error message

No tier price found with the specified id

What it means

Thrown by the POST TierPriceDelete admin action when the tier price ID passed in does not resolve to any tier price row. The action calls _productService.GetTierPriceByIdAsync(id) and uses a null-coalescing throw to immediately raise an ArgumentException. Unlike the product-not-found errors, this fires on the primary entity lookup itself, not a parent reference.

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs:3171

            ViewBag.RefreshPage = true;

            return View(model);
        }

        //prepare model
        model = await _productModelFactory.PrepareTierPriceModelAsync(model, product, tierPrice, true);

        //if we got this far, something failed, redisplay form
        return View(model);
    }

    [HttpPost]
    [CheckPermission(StandardPermission.Catalog.PRODUCTS_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> TierPriceDelete(int id)
    {
        //try to get a tier price with the specified id
        var tierPrice = await _productService.GetTierPriceByIdAsync(id)
            ?? throw new ArgumentException("No tier price found with the specified id");

        //try to get a product with the specified id
        var product = await _productService.GetProductByIdAsync(tierPrice.ProductId)
            ?? throw new ArgumentException("No product found with the specified id");

        //a vendor should have access only to his products
        var currentVendor = await _workContext.GetCurrentVendorAsync();
        if (currentVendor != null && product.VendorId != currentVendor.Id)
            return Content("This is not your product");

        await _productService.DeleteTierPriceAsync(tierPrice);

        return new NullJsonResult();
    }

    #endregion

    #region Product attributes

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Check whether the tier price still exists before retrying — refresh the product's Tier Prices tab.
  2. If you control the action, return a NullJsonResult or a 404 instead of throwing so the AJAX grid handles missing rows gracefully.
  3. Ensure the frontend disables the delete button after the first click to prevent duplicate submissions.
  4. Audit server logs for the exact id value to determine if the request is stale or malicious.

Example fix

// before
var tierPrice = await _productService.GetTierPriceByIdAsync(id)
    ?? throw new ArgumentException("No tier price found with the specified id");

// after
var tierPrice = await _productService.GetTierPriceByIdAsync(id);
if (tierPrice == null)
    return new NullJsonResult();
Defensive patterns

Strategy: validation

Validate before calling

// Before calling delete, verify the tier price exists
var tierPrice = await _productService.GetTierPriceByIdAsync(id);
if (tierPrice == null) return new NullJsonResult(); // already gone — treat as success

Type guard

public static bool TierPriceExists(int id, IProductService service) =>
    service.GetTierPriceByIdAsync(id).GetAwaiter().GetResult() != null;

Try / catch

try
{
    return await _controller.TierPriceDelete(id);
}
catch (ArgumentException ex) when (ex.Message.Contains("No tier price found"))
{
    _logger.LogInformation("Tier price {Id} already deleted", id);
    return new NullJsonResult();
}

Prevention

When it happens

Trigger: An AJAX delete call (POST /Admin/Product/TierPriceDelete?id=<id>) is issued for a tier price ID that does not exist — the row was already deleted, the ID was tampered, or the grid is stale.

Common situations: Double-click on a delete button where the first call succeeds and the second hits a now-missing row; browser back/forward replaying a stale AJAX request; a cron or script attempting to delete tier prices that were already removed; ID manipulation in a crafted POST.

Related errors


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