bensheldon/good_job · error · ArgumentError

GoodJob dequeue query sortmust be one of #{DEQUEUE_QUERY_SOR

Error message

GoodJob dequeue query sortmust be one of #{DEQUEUE_QUERY_SORTS.join(', ')}. It was '#{dequeue_query_sort}' which is not valid.

What it means

Error "GoodJob dequeue query sortmust be one of #{DEQUEUE_QUERY_SORTS.join(', ')}. It was '#{dequeue_query_sort}' which is not valid." thrown in bensheldon/good_job.

Source

Thrown at lib/good_job/configuration.rb:56

    # Default Dashboard Live Poll button enabled
    DEFAULT_DASHBOARD_LIVE_POLL_ENABLED = true
    # Default enqueue_after_transaction_commit
    DEFAULT_ENQUEUE_AFTER_TRANSACTION_COMMIT = false
    # Default enable_pauses setting
    DEFAULT_ENABLE_PAUSES = false
    # Default number of candidate jobs to query when polling
    DEFAULT_QUEUE_SELECT_LIMIT = 1_000
    # Valid dequeue query sorts
    DEQUEUE_QUERY_SORTS = [:created_at, :scheduled_at].freeze
    # Valid lock strategies
    LOCK_STRATEGIES = [:advisory, :skiplocked, :hybrid].freeze

    def self.validate_execution_mode(execution_mode)
      raise ArgumentError, "GoodJob execution mode must be one of #{EXECUTION_MODES.join(', ')}. It was '#{execution_mode}' which is not valid." unless execution_mode.in?(EXECUTION_MODES)
    end

    def self.validate_dequeue_query_sort(dequeue_query_sort)
      raise ArgumentError, "GoodJob dequeue query sortmust be one of #{DEQUEUE_QUERY_SORTS.join(', ')}. It was '#{dequeue_query_sort}' which is not valid." unless dequeue_query_sort.in?(DEQUEUE_QUERY_SORTS)
    end

    # The options that were explicitly set when initializing +Configuration+.
    # It is safe to modify this hash in place; be sure to symbolize keys.
    # @return [Hash]
    attr_reader :options

    # The environment from which to read GoodJob's environment variables. By
    # default, this is the current process's environment, but it can be set
    # to something else in {#initialize}.
    # @return [Hash]
    attr_reader :env

    # Returns the maximum number of threads GoodJob might consume
    # @param warn [Boolean] whether to print a warning when over the limit
    # @return [Integer]
    def self.total_estimated_threads(warn: false)
      utility_threads = GoodJob::SharedExecutor::MAX_THREADS

View on GitHub (pinned to 5fcde48f87)

Solutions

  1. Set dequeue_query_sort to one of the listed valid sorts.
  2. Fix the GOOD_JOB_DEQUEUE_QUERY_SORT env var or config value to a supported sort.

Example fix

config.good_job.dequeue_query_sort = :scheduled_at

When it happens

Trigger: Thrown at lib/good_job/configuration.rb:56 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/a54d903bc4ff2001. Report an issue: GitHub.