discourse/discourse · error · Discourse::InvalidAccess

raise Discourse::InvalidAccess.new

Error message

raise Discourse::InvalidAccess.new

What it means

Error "raise Discourse::InvalidAccess.new" thrown in discourse/discourse.

Source

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

      on_failed_policy(:ensure_remote_themes_are_not_allowlisted) { raise Discourse::InvalidAccess }
      on_model_errors { |theme:| render json: theme.errors, status: :unprocessable_entity }
      on_model_not_found(:theme) do |result|
        raise Discourse::NotFound if !result.exception
        render json: failed_json.merge(errors: result.exception.message), status: :bad_request
      end
    end
  end

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

    original_json = ThemeSerializer.new(@theme, root: false).to_json
    disables_component = [false, "false"].include?(theme_params[:enabled])
    enables_component = [true, "true"].include?(theme_params[:enabled])

    if @theme.system? && (theme_params.keys - Theme::EDITABLE_SYSTEM_ATTRIBUTES).present?
      raise Discourse::InvalidAccess.new
    end

    %i[
      name
      color_scheme_id
      dark_color_scheme_id
      user_selectable
      enabled
      auto_update
    ].each do |field|
      @theme.public_send("#{field}=", theme_params[field]) if theme_params.key?(field)
    end

    @theme.child_theme_ids = theme_params[:child_theme_ids] if theme_params.key?(:child_theme_ids)

    @theme.parent_theme_ids = theme_params[:parent_theme_ids] if theme_params.key?(
      :parent_theme_ids,
    )

View on GitHub (pinned to 1b2d7253e8)

When it happens

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