bensheldon/good_job · error · ArgumentError
Invalid cron format: '#{cron}'
Error message
Invalid cron format: '#{cron}' What it means
Error "Invalid cron format: '#{cron}'" thrown in bensheldon/good_job.
Source
Thrown at app/models/good_job/cron_entry.rb:64
GoodJob::Job
.select("lateral_jobs.*")
.from(from_clause)
.joins(join_clause)
.index_by(&:cron_key)
end
def self.find(key, configuration: nil)
all(configuration: configuration).find { |entry| entry.key == key.to_sym }.tap do |cron_entry|
raise ActiveRecord::RecordNotFound unless cron_entry
end
end
def initialize(params = {})
@params = params
return if cron_proc?
raise ArgumentError, "Invalid cron format: '#{cron}'" unless fugit.instance_of?(Fugit::Cron)
end
def key
params.fetch(:key)
end
alias id key
alias to_param key
def job_class
params.fetch(:class)
end
def set
params[:set]
end
def argsView on GitHub (pinned to 5fcde48f87)
Solutions
- Verify the cron string in your `config.good_job.cron` entry is a valid cron expression accepted by fugit (e.g. "0 * * * *" or natural forms like "every day at midnight").
- Check for typos: missing or extra fields, unsupported characters, or out-of-range values (minute 0-59, hour 0-23, day of month 1-31, month 1-12, day of week 0-6).
- If you need custom scheduling logic instead of a cron string, pass a `cron_proc` lambda; the format check is skipped for procs.
- Test the expression in a Rails console with `Fugit::Cron.parse(your_cron_string)`; it must return a Fugit::Cron instance, not nil.
Example fix
# config/initializers/good_job.rb
Rails.application.configure do
config.good_job.cron = {
my_task: {
# was "0 0 * *" (too few fields) or another invalid expression
cron: "0 0 * * *",
class: "MyJob"
}
}
end When it happens
Trigger: Thrown at app/models/good_job/cron_entry.rb:64 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/cabd4b26dd1b81f4.
Report an issue: GitHub.