nopSolutions/nopCommerce · error · ArgumentException

No configuration found with the specified id

Error message

No configuration found with the specified id

What it means

Thrown by FacebookPixelController.CustomEventList when _facebookPixelService.GetConfigurationByIdAsync(searchModel.ConfigurationId) returns null. The action expects an existing Facebook Pixel configuration row; a missing row means the grid request references a configuration that does not exist.

Source

Thrown at src/Plugins/Nop.Plugin.Widgets.FacebookPixel/Controllers/FacebookPixelController.cs:253

    {
        var configuration = await _facebookPixelService.GetConfigurationByIdAsync(id);
        if (configuration == null)
            return RedirectToAction("Configure", "FacebookPixel");

        //delete configuration
        await _facebookPixelService.DeleteConfigurationAsync(configuration);

        _notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Admin.Plugins.Saved"));

        return RedirectToAction("Configure", "FacebookPixel");
    }

    [HttpPost]
    [CheckPermission(StandardPermission.Configuration.MANAGE_WIDGETS)]
    public virtual async Task<IActionResult> CustomEventList(CustomEventSearchModel searchModel)
    {
        var configuration = await _facebookPixelService.GetConfigurationByIdAsync(searchModel.ConfigurationId)
            ?? throw new ArgumentException("No configuration found with the specified id", nameof(searchModel.ConfigurationId));

        var customEvents = (await _facebookPixelService.GetCustomEventsAsync(configuration.Id, searchModel.WidgetZone)).ToPagedList(searchModel);
        var model = new CustomEventListModel().PrepareToGrid(searchModel, customEvents, () =>
        {
            //fill in model values from the configuration
            return customEvents.Select(customEvent => new CustomEventModel
            {
                ConfigurationId = configuration.Id,
                EventName = customEvent.EventName,
                WidgetZonesName = string.Join(", ", customEvent.WidgetZones)
            });
        });

        return Json(model);
    }

    //ValidateAttribute is used to force model validation
    [HttpPost]

View on GitHub (pinned to 64bdf2ff08)

Solutions

  1. Reload the parent configuration list to get a valid ConfigurationId.
  2. Guard the grid action to return an empty result (or NotFound) instead of throwing for a missing configuration.
  3. Ensure the configuration is created before navigating to its custom-events tab.

Example fix

// before
var configuration = await _facebookPixelService.GetConfigurationByIdAsync(searchModel.ConfigurationId)
    ?? throw new ArgumentException("No configuration found with the specified id", nameof(searchModel.ConfigurationId));

// after — graceful empty grid instead of 500
var configuration = await _facebookPixelService.GetConfigurationByIdAsync(searchModel.ConfigurationId);
if (configuration is null)
    return Ok(new { Data = Array.Empty<CustomEventModel>(), RecordsTotal = 0, RecordsFiltered = 0, Draw = searchModel.Draw });
Defensive patterns

Strategy: validation

Validate before calling

var configuration = await _facebookPixelService.GetConfigurationByIdAsync(searchModel.ConfigurationId);
if (configuration is null) return EmptyGrid(searchModel);

Try / catch

try { return await CustomEventList(searchModel); }
catch (ArgumentException ex) when (ex.Message.Contains("No configuration found"))
{ return NotFound(); }

Prevention

When it happens

Trigger: The custom-events grid is loaded for a ConfigurationId that was deleted, never existed, or was passed incorrectly (query string tampering, stale admin link).

Common situations: Admin opens an old bookmarked/tab after the configuration was deleted; concurrent admin deletion while another browses the grid; ConfigurationId of 0 or default sent by a malformed request.

Related errors


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