{"record":{"id":"eda8e7b479ff6b6e","repo":"OrchardCMS/OrchardCore","slug":"invalid-bulk-action-deploymentplancontroller","errorCode":null,"errorMessage":"Invalid bulk action.","messagePattern":"Invalid bulk action\\.","errorType":"exception","errorClass":"ArgumentOutOfRangeException","httpStatus":500,"severity":"error","filePath":"src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs","lineNumber":149,"sourceCode":"            return Forbid();\n        }\n\n        if (itemIds?.Any() == true)\n        {\n            var checkedItems = await _session.Query<DeploymentPlan, DeploymentPlanIndex>().Where(x => x.DocumentId.IsIn(itemIds)).ListAsync();\n            switch (options.BulkAction)\n            {\n                case ContentsBulkAction.None:\n                    break;\n                case ContentsBulkAction.Delete:\n                    foreach (var item in checkedItems)\n                    {\n                        _session.Delete(item);\n                    }\n                    await _notifier.SuccessAsync(H[\"Deployment plans successfully deleted.\"]);\n                    break;\n                default:\n                    throw new ArgumentOutOfRangeException(options.BulkAction.ToString(), \"Invalid bulk action.\");\n            }\n        }\n\n        return RedirectToAction(nameof(Index));\n    }\n\n    public async Task<IActionResult> Display(long id)\n    {\n        if (!await _authorizationService.AuthorizeAsync(User, DeploymentPermissions.ManageDeploymentPlan))\n        {\n            return Forbid();\n        }\n\n        var deploymentPlan = await _session.GetAsync<DeploymentPlan>(id);\n\n        if (deploymentPlan == null)\n        {\n            return NotFound();","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/OrchardCMS/OrchardCore/blob/4306c0717fe573f6fca1b4955909ddab6a192807/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs#L131-L167","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\n<form method=\"post\"><input name=\"BulkAction\" value=\"purge-all\" />...</form>\n// after\n<form method=\"post\"><input name=\"BulkAction\" value=\"Delete\" />...</form>","handlingStrategy":"try-catch","validationCode":"var allowed = new[] { \"Delete\" };\nif (!allowed.Contains(bulkAction, StringComparer.OrdinalIgnoreCase))\n    throw new ArgumentException($\"Unsupported bulk action '{bulkAction}'.\");","typeGuard":null,"tryCatchPattern":"try { await client.PostAsync(\"/Admin/DeploymentPlan/Index\", form); } catch (ArgumentOutOfRangeException ex) { logger.LogError(ex, \"Invalid bulk action posted\"); }","preventionTips":["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."],"tags":["deployment","bulk-action","argument-out-of-range"],"backgroundTag":"invalid-enum-value","analyzedSha":"4306c0717fe573f6fca1b4955909ddab6a192807","analyzedAt":"2026-09-13T17:41:05.024Z","contentChangedAt":"2026-09-13T17:41:05.024Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}