{"record":{"id":"1a0f246fea84096d","repo":"nopSolutions/nopCommerce","slug":"no-activity-log-found-with-the-specified-id","errorCode":null,"errorMessage":"No activity log found with the specified id","messagePattern":"No activity log found with the specified id","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"warning","filePath":"src/Presentation/Nop.Web/Areas/Admin/Controllers/ActivityLogController.cs","lineNumber":105,"sourceCode":"    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Customers.ACTIVITY_LOG_VIEW)]\n    public virtual async Task<IActionResult> ListLogs(ActivityLogSearchModel searchModel)\n    {\n        //prepare model\n        var model = await _activityLogModelFactory.PrepareActivityLogListModelAsync(searchModel);\n\n        return Json(model);\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Customers.ACTIVITY_LOG_DELETE)]\n    public virtual async Task<IActionResult> ActivityLogDelete(int id)\n    {\n        //try to get a log item with the specified id\n        var logItem = await _customerActivityService.GetActivityByIdAsync(id)\n            ?? throw new ArgumentException(\"No activity log found with the specified id\", nameof(id));\n\n        await _customerActivityService.DeleteActivityAsync(logItem);\n\n        //activity log\n        await _customerActivityService.InsertActivityAsync(\"DeleteActivityLog\",\n            await _localizationService.GetResourceAsync(\"ActivityLog.DeleteActivityLog\"), logItem);\n\n        return new NullJsonResult();\n    }\n\n    [HttpPost]\n    [CheckPermission(StandardPermission.Customers.ACTIVITY_LOG_DELETE)]\n    public virtual async Task<IActionResult> ClearAll()\n    {\n        await _customerActivityService.ClearAllActivitiesAsync();\n\n        //activity log\n        await _customerActivityService.InsertActivityAsync(\"DeleteActivityLog\", await _localizationService.GetResourceAsync(\"ActivityLog.DeleteActivityLog\"));","sourceCodeStart":87,"sourceCodeEnd":123,"githubUrl":"https://github.com/nopSolutions/nopCommerce/blob/64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2/src/Presentation/Nop.Web/Areas/Admin/Controllers/ActivityLogController.cs#L87-L123","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nvar logItem = await _customerActivityService.GetActivityByIdAsync(id)\n    ?? throw new ArgumentException(\"No activity log found with the specified id\", nameof(id));\n\n// after (idempotent)\nvar logItem = await _customerActivityService.GetActivityByIdAsync(id);\nif (logItem == null)\n    return new NullJsonResult();\n","handlingStrategy":"fallback","validationCode":"// Treat a missing activity log as already-deleted (idempotent).\nvar logItem = await _customerActivityService.GetActivityByIdAsync(id);\nif (logItem == null) return new NullJsonResult();","typeGuard":"static bool ActivityLogExists(ActivityLog item) => item is not null;","tryCatchPattern":"try { /* ActivityLogDelete body */ }\ncatch (ArgumentException ex) when (ex.ParamName == nameof(id))\n{\n    // already gone — benign for a delete\n    _logger.Information($\"Activity log {id} already deleted\");\n    return new NullJsonResult();\n}","preventionTips":["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."],"tags":["nopcommerce","admin","activity-log","not-found","concurrency"],"backgroundTag":null,"analyzedSha":"64bdf2ff08c8b39e65717bcf974fb43dc2ef68f2","analyzedAt":"2026-08-13T21:19:38.062Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}