bensheldon/good_job · error · ActionController::BadRequest

#{mass_action} is not a valid mass action

Error message

#{mass_action} is not a valid mass action

What it means

Error "#{mass_action} is not a valid mass action" thrown in bensheldon/good_job.

Source

Thrown at app/controllers/good_job/jobs_controller.rb:25

    ACTIONS = {
      discard: "discarded",
      reschedule: "rescheduled",
      retry: "retried",
      destroy: "destroyed",
    }.freeze

    rescue_from GoodJob::Job::AdapterNotGoodJobError,
                GoodJob::Job::ActionForStateMismatchError,
                with: :redirect_on_error

    def index
      @filter = JobsFilter.new(params)
    end

    def mass_update
      mass_action = params.fetch(:mass_action, "").to_sym
      raise ActionController::BadRequest, "#{mass_action} is not a valid mass action" unless mass_action.in?(ACTIONS.keys)

      jobs = if params[:all_job_ids]
               JobsFilter.new(params).filtered_query
             else
               job_ids = params.fetch(:job_ids, [])
               Job.where(active_job_id: job_ids)
             end

      processed_jobs = jobs.map do |job|
        case mass_action
        when :discard
          job.discard_job(DISCARD_MESSAGE)
        when :reschedule
          job.reschedule_job
        when :retry
          use_original_locale { job.retry_job }
        when :destroy
          job.destroy_job

View on GitHub (pinned to 5fcde48f87)

Solutions

  1. Pass one of the supported mass actions (e.g. discard, retry, destroy) in the mass_action parameter.
  2. Check the mass_action param in your request against the actions allowed by GoodJob::JobsController.

Example fix

# Use a valid mass action, e.g. POST with mass_action=retry

When it happens

Trigger: Thrown at app/controllers/good_job/jobs_controller.rb:25 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of bensheldon/good_job@5fcde48f87 (2026-08-23). Data as JSON: /api/errors/e9ae58a9ebff7778. Report an issue: GitHub.