nopSolutions/nopCommerce · error · ArgumentException

No vendor note found with the specified id

Error message

No vendor note found with the specified id

What it means

Thrown by VendorController.VendorNoteDelete when GetVendorNoteByIdAsync(id) returns null. The delete action (behind VENDORS_CREATE_EDIT_DELETE permission) removes a vendor note by id; a null lookup throws ArgumentException before DeleteVendorNoteAsync. This closes the vendor notes region of the controller.

Source

Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/VendorController.cs:535

            return ErrorJson("Vendor cannot be loaded");

        await _vendorService.InsertVendorNoteAsync(new VendorNote
        {
            Note = message,
            CreatedOnUtc = DateTime.UtcNow,
            VendorId = vendor.Id
        });

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

    [HttpPost]
    [CheckPermission(StandardPermission.Customers.VENDORS_CREATE_EDIT_DELETE)]
    public virtual async Task<IActionResult> VendorNoteDelete(int id)
    {
        //try to get a vendor note with the specified id
        var vendorNote = await _vendorService.GetVendorNoteByIdAsync(id)
            ?? throw new ArgumentException("No vendor note found with the specified id", nameof(id));

        await _vendorService.DeleteVendorNoteAsync(vendorNote);

        return new NullJsonResult();
    }

    #endregion
}

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Dismiss the error and reload the notes grid; the note is already deleted.
  2. Disable the delete button after first click to prevent double-submission.
  3. For API callers, treat null as idempotent success.
  4. Wrap the action to return NullJsonResult on a missing note.

Example fix

// before
var vendorNote = await _vendorService.GetVendorNoteByIdAsync(id)
    ?? throw new ArgumentException("No vendor note found with the specified id", nameof(id));
await _vendorService.DeleteVendorNoteAsync(vendorNote);

// after
var vendorNote = await _vendorService.GetVendorNoteByIdAsync(id);
if (vendorNote is null)
    return new NullJsonResult(); // idempotent
Defensive patterns

Strategy: validation

Validate before calling

var note = await _vendorService.GetVendorNoteByIdAsync(id);
if (note is null)
    return; // already deleted — idempotent

Try / catch

try { await controller.VendorNoteDelete(id); }
catch (ArgumentException ex) when (ex.Message.Contains("No vendor note"))
{ /* note already removed — no-op */ }

Prevention

When it happens

Trigger: Double-click on 'delete note' in the vendor-notes grid; the first call succeeds and the second hits null. Concurrent deletion from another session. A programmatic delete with a stale note id.

Common situations: User double-clicks the note delete control. Another admin removed the note between page load and delete. The note was auto-removed by a cleanup routine while a stale grid still displayed it.

Related errors


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