{"record":{"id":"42d59e80e482a0ba","repo":"nopSolutions/nopCommerce","slug":"no-filter-level-value-mapping-found-with-the-speci","errorCode":null,"errorMessage":"No filter level value mapping found with the specified id","messagePattern":"No filter level value mapping found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs","lineNumber":1920,"sourceCode":"        var currentVendor = await _workContext.GetCurrentVendorAsync();\n        if (currentVendor != null && product.VendorId != currentVendor.Id)\n            return Content(\"This is not your product\");\n\n        //prepare model\n        var model = await _productModelFactory.PrepareFilterLevelValueListModelAsync(searchModel, product);\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Catalog.FILTER_LEVEL_VALUE_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> FilterLevelValueDelete(int productId, int id)\n    {\n        //try to get a filter level value mapping with the specified id\n        var existingProductFilterLevelValues = await _filterLevelValueService.GetFilterLevelValueProductsByFilterLevelValueIdAsync(id);\n\n        var filterLevelValueMapping = existingProductFilterLevelValues.FirstOrDefault(pc => pc.ProductId == productId && pc.FilterLevelValueId == id)\n            ?? throw new ArgumentException(\"No filter level value mapping found with the specified id\");\n\n        //a vendor should have access only to his products\n        var currentVendor = await _workContext.GetCurrentVendorAsync();\n        if (currentVendor != null)\n        {\n            var product = await _productService.GetProductByIdAsync(filterLevelValueMapping.ProductId);\n            if (product != null && product.VendorId != currentVendor.Id)\n                return Content(\"This is not your product\");\n        }\n\n        await _filterLevelValueService.DeleteFilterLevelValueProductAsync(filterLevelValueMapping);\n\n        return new NullJsonResult();\n    }\n\n    [CheckPermission(StandardPermission.Catalog.FILTER_LEVEL_VALUE_CREATE_EDIT_DELETE)]\n    public virtual async Task<IActionResult> FilterLevelValuesAddPopup(int productId)\n    {","sourceCodeStart":1902,"sourceCodeEnd":1938,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/ProductController.cs#L1902-L1938","documentation":"Thrown by the FilterLevelValueDelete action when no mapping in existingProductFilterLevelValues matches the given (productId, id) pair — i.e. FirstOrDefault(...) returns null and the ?? throw new ArgumentException fires. Unlike the other lookups, this first fetches all mappings for the filter-level-value id, then filters client-side by productId. The uncaught ArgumentException propagates as an HTTP 500 to the grid delete request.","triggerScenarios":"POST to delete a filter-level-value/product mapping where the combination of productId and id does not exist — the mapping was already deleted, productId and id don't pair, or the grid row is stale.","commonSituations":"Concurrent deletes of the same mapping; a grid row stale after prior deletion; programmatic delete passing mismatched productId and id; double-submit on delete.","solutions":["Reload the grid — the mapping is already gone; treat the operation as a no-op success.","Make delete idempotent by returning NullJsonResult when no mapping matches.","Verify both productId and id are valid and paired before submitting.","Disable the delete control client-side after the first click."],"exampleFix":"// before\nvar filterLevelValueMapping = existingProductFilterLevelValues\n    .FirstOrDefault(pc => pc.ProductId == productId && pc.FilterLevelValueId == id)\n    ?? throw new ArgumentException(\"No filter level value mapping found with the specified id\");\n\n// after — idempotent delete\nvar filterLevelValueMapping = existingProductFilterLevelValues\n    .FirstOrDefault(pc => pc.ProductId == productId && pc.FilterLevelValueId == id);\nif (filterLevelValueMapping == null)\n    return new NullJsonResult();","handlingStrategy":"validation","validationCode":"// Idempotent delete: tolerate missing (productId, id) pairings\nvar mappings = await _filterLevelValueService.GetFilterLevelValueProductsByFilterLevelValueIdAsync(id);\nvar mapping = mappings.FirstOrDefault(pc => pc.ProductId == productId && pc.FilterLevelValueId == id);\nif (mapping == null)\n    return new NullJsonResult(); // already deleted / not paired","typeGuard":"if (productId <= 0 || id <= 0) return BadRequest(\"Invalid ids\");","tryCatchPattern":"try { var m = existingProductFilterLevelValues.FirstOrDefault(pc => pc.ProductId == productId && pc.FilterLevelValueId == id); if (m == null) return new NullJsonResult(); ... } catch (ArgumentException) { return new NullJsonResult(); }","preventionTips":["Make delete idempotent — a missing mapping is a no-op success.","Verify productId and id are a valid pair before submitting.","Refresh the grid after delete to clear stale rows."],"tags":["nopcommerce","admin","product","filter-level-value","entity-not-found","argumentexception","delete","idempotency"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}