nopSolutions/nopCommerce · warning · ArgumentException
No activity log found with the specified id
Error message
No activity log found with the specified id
What it means
Thrown by ActivityLogController.ActivityLogDelete (permission: ACTIVITY_LOG_DELETE). It looks up the activity log row by id and throws ArgumentException if GetActivityByIdAsync returns null — the record was already deleted or never existed.
Source
Thrown at src/Presentation/Nop.Web/Areas/Admin/Controllers/ActivityLogController.cs:105
}
[HttpPost]
[CheckPermission(StandardPermission.Customers.ACTIVITY_LOG_VIEW)]
public virtual async Task<IActionResult> ListLogs(ActivityLogSearchModel searchModel)
{
//prepare model
var model = await _activityLogModelFactory.PrepareActivityLogListModelAsync(searchModel);
return Json(model);
}
[HttpPost]
[CheckPermission(StandardPermission.Customers.ACTIVITY_LOG_DELETE)]
public virtual async Task<IActionResult> ActivityLogDelete(int id)
{
//try to get a log item with the specified id
var logItem = await _customerActivityService.GetActivityByIdAsync(id)
?? throw new ArgumentException("No activity log found with the specified id", nameof(id));
await _customerActivityService.DeleteActivityAsync(logItem);
//activity log
await _customerActivityService.InsertActivityAsync("DeleteActivityLog",
await _localizationService.GetResourceAsync("ActivityLog.DeleteActivityLog"), logItem);
return new NullJsonResult();
}
[HttpPost]
[CheckPermission(StandardPermission.Customers.ACTIVITY_LOG_DELETE)]
public virtual async Task<IActionResult> ClearAll()
{
await _customerActivityService.ClearAllActivitiesAsync();
//activity log
await _customerActivityService.InsertActivityAsync("DeleteActivityLog", await _localizationService.GetResourceAsync("ActivityLog.DeleteActivityLog"));View on GitHub (pinned to 64bdf2ff08)
Solutions
- Reload the activity log grid and retry only if the row still exists.
- Treat a missing row as success (idempotent delete) instead of throwing.
- Wrap the AJAX delete handler to ignore 404-equivalent errors for already-removed rows.
Example fix
// before
var logItem = await _customerActivityService.GetActivityByIdAsync(id)
?? throw new ArgumentException("No activity log found with the specified id", nameof(id));
// after (idempotent)
var logItem = await _customerActivityService.GetActivityByIdAsync(id);
if (logItem == null)
return new NullJsonResult();
Defensive patterns
Strategy: fallback
Validate before calling
// Treat a missing activity log as already-deleted (idempotent). var logItem = await _customerActivityService.GetActivityByIdAsync(id); if (logItem == null) return new NullJsonResult();
Type guard
static bool ActivityLogExists(ActivityLog item) => item is not null;
Try / catch
try { /* ActivityLogDelete body */ }
catch (ArgumentException ex) when (ex.ParamName == nameof(id))
{
// already gone — benign for a delete
_logger.Information($"Activity log {id} already deleted");
return new NullJsonResult();
} Prevention
- Make deletes idempotent at the controller boundary.
- Disable the delete control client-side after the first click.
- Refresh the grid before retrying a delete that may have already succeeded.
When it happens
Trigger: POST ActivityLogDelete with an id that does not exist: double-submit of the delete button, a stale grid row after another admin deleted the same entry, or a tampered id.
Common situations: Concurrent admin users pruning activity logs; the user re-clicks delete on a row that was removed by the retention job; stale UI after a refresh.
Related errors
- No address attribute value found with the specified id
- No comment found with the specified id
- No product category mapping found with the specified id
- No checkout attribute value found with the specified id
- No contact form attribute value found with the specified id
AI-assisted analysis of nopSolutions/nopCommerce@64bdf2ff08 (2026-08-13).
Data as JSON: /api/errors/1a0f246fea84096d.
Report an issue: GitHub.