discourse/discourse · error · RuntimeError

To run this rake task in a production site, set the value of

Error message

To run this rake task in a production site, set the value of `ALLOW_DEV_POPULATE` environment variable to "1"

What it means

Error "To run this rake task in a production site, set the value of `ALLOW_DEV_POPULATE` environment variable to "1"" thrown in discourse/discourse.

Source

Thrown at lib/discourse_dev/application_request.rb:27

    LEGACY_OVERHEAD = 3

    WEEKEND_FACTOR = 0.7
    JITTER_RANGE = 0.30
    DRIFT_FLOOR = 0.5
    SPIKE_MIN = 2.0
    SPIKE_RANGE = 2.0

    def initialize
      settings = DiscourseDev.config.application_request
      @baseline = settings[:logged_in_browser_pageviews_per_day]
      @end_date = Date.yesterday
      @start_date = 2.years.ago.to_date
      @random = Random.new(DiscourseDev.config.seed || 1)
    end

    def populate!
      unless Discourse.allow_dev_populate?
        raise 'To run this rake task in a production site, set the value of `ALLOW_DEV_POPULATE` environment variable to "1"'
      end

      rows = build_rows
      puts "Seeding #{rows.size} application_requests rows from #{@start_date} to #{@end_date}"
      bulk_upsert(rows)
      rows.size
    end

    def self.populate!
      new.populate!
    end

    private

    def build_rows
      spike_dates = pick_spike_dates
      total_days = [(@end_date - @start_date).to_i, 1].max
      rows = []

View on GitHub (pinned to 1b2d7253e8)

When it happens

Trigger: Thrown at lib/discourse_dev/application_request.rb:27 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of discourse/discourse@1b2d7253e8 (2026-08-26). Data as JSON: /api/errors/7d72912b68d7dc66. Report an issue: GitHub.