discourse/discourse · error · Discourse::InvalidParameters

raise Discourse::InvalidParameters.new(:setting_name) unless

Error message

raise Discourse::InvalidParameters.new(:setting_name) unless theme_setting

What it means

Error "raise Discourse::InvalidParameters.new(:setting_name) unless theme_setting" thrown in discourse/discourse.

Source

Thrown at app/controllers/admin/themes_controller.rb:376

        end
      end
      on_failed_policy(:current_user_is_admin) { raise Discourse::InvalidAccess }
      on_failed_policy(:ensure_setting_is_themeable) do
        render_json_error(I18n.t("themes.setting_not_themeable", name: params[:name]), status: 400)
      end
      on_model_not_found(:theme) { raise Discourse::NotFound }
    end
  end

  def schema
  end

  def objects_setting_metadata
    theme = Theme.find_by(id: params[:id])
    raise Discourse::InvalidParameters.new(:id) unless theme

    theme_setting = theme.settings[params[:setting_name].to_sym]
    raise Discourse::InvalidParameters.new(:setting_name) unless theme_setting

    render_serialized(theme_setting, ThemeObjectsSettingMetadataSerializer, root: false)
  end

  def update_source
    @theme = Theme.include_relations.find_by(id: params[:id])
    raise Discourse::InvalidParameters.new(:id) unless @theme
    raise Discourse::InvalidParameters.new(:remote_theme) unless @theme.remote_theme&.is_git?

    remote_url = params[:remote_url]&.strip
    raise Discourse::InvalidParameters.new(:remote_url) if remote_url.blank?

    if remote_url.length > MAX_REMOTE_LENGTH
      error = I18n.t("themes.import_error.not_allowed_theme", { repo: remote_url[0..100] })
      return render_json_error(error, status: 422)
    end

    begin

View on GitHub (pinned to 1b2d7253e8)

When it happens

Trigger: Thrown at app/controllers/admin/themes_controller.rb:376 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/19a6da8ef85ffaa0. Report an issue: GitHub.