OrchardCMS/OrchardCore · error · ArgumentOutOfRangeException
Invalid bulk action.
Error message
Invalid bulk action.
What it means
DeploymentPlanController.Index POST validates the submitted bulk-action value against a known set (e.g. delete) and throws ArgumentOutOfRangeException for anything unrecognized. The library only supports the bulk actions it renders in the UI, so any other value is rejected as invalid.
Solutions
- Post only supported bulk action values exactly as rendered by the admin UI form.
- Clear browser cache / refresh the admin page so a stale form posts current values.
- If adding a custom bulk action, extend the controller switch statement to handle the new value.
- Wrap the post in error handling and validate the BulkAction value client-side before submission.
Example fix
// before <form method="post"><input name="BulkAction" value="purge-all" />...</form> // after <form method="post"><input name="BulkAction" value="Delete" />...</form>
Defensive patterns
Strategy: try-catch
Validate before calling
var allowed = new[] { "Delete" };
if (!allowed.Contains(bulkAction, StringComparer.OrdinalIgnoreCase))
throw new ArgumentException($"Unsupported bulk action '{bulkAction}'."); Try / catch
try { await client.PostAsync("/Admin/DeploymentPlan/Index", form); } catch (ArgumentOutOfRangeException ex) { logger.LogError(ex, "Invalid bulk action posted"); } Prevention
- Only submit bulk actions exactly as rendered by the shipped admin form.
- Re-fetch the admin page after upgrades so forms are not stale.
- Extend the controller switch when adding custom bulk actions.
When it happens
Trigger: Posting to the Deployment Plan Index action with form field BulkAction set to a value not handled by the switch statement (e.g. tampered form, stale client, custom script or integration sending an unsupported action).
Common situations: Custom admin scripts or automated tooling posting to the deployment plans endpoint with a hardcoded bulk action string that does not match the shipped options; a UI/plugin change that adds an option without adding the server-side switch case.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Invalid bulk action.
- A virtual path is required
- Invalid bulk action.
- Invalid bulk action.
- Unexpected merge array handling when merging JSON.
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/eda8e7b479ff6b6e.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs:149
return Forbid();
}
if (itemIds?.Any() == true)
{
var checkedItems = await _session.Query<DeploymentPlan, DeploymentPlanIndex>().Where(x => x.DocumentId.IsIn(itemIds)).ListAsync();
switch (options.BulkAction)
{
case ContentsBulkAction.None:
break;
case ContentsBulkAction.Delete:
foreach (var item in checkedItems)
{
_session.Delete(item);
}
await _notifier.SuccessAsync(H["Deployment plans successfully deleted."]);
break;
default:
throw new ArgumentOutOfRangeException(options.BulkAction.ToString(), "Invalid bulk action.");
}
}
return RedirectToAction(nameof(Index));
}
public async Task<IActionResult> Display(long id)
{
if (!await _authorizationService.AuthorizeAsync(User, DeploymentPermissions.ManageDeploymentPlan))
{
return Forbid();
}
var deploymentPlan = await _session.GetAsync<DeploymentPlan>(id);
if (deploymentPlan == null)
{
return NotFound();View on GitHub (pinned to 4306c0717f)