theforeman/foreman · error · ArgumentError

Value of '#{label}' passed to #{method} must be #{options}

Error message

Value of '#{label}' passed to #{method} must be #{options}

What it means

Error "Value of '#{label}' passed to #{method} must be #{options}" thrown in theforeman/foreman.

Source

Thrown at app/services/foreman/renderer/scope/macros/loaders.rb:104

            base = base.search_for(search)
            base = base.preload(preload) unless preload.nil?
            base = base.includes(includes) unless includes.nil?
            base = base.joins(joins) unless joins.nil?
            base = base.authorized(permission) unless permission.nil?
            base = base.limit(limit) unless limit.nil?
            base = base.where(where) unless where.nil?
            base = base.select(select) unless select.nil?
            base.in_batches(of: batch)
          end

          def type_check!(method, label, what, spec)
            return if what.nil?
            return if spec.any? { |type, subtype| what.is_a?(type) && (subtype.nil? || what.all? { |value| value.is_a?(subtype) }) }

            options = spec.map { |type, subtype| subtype.nil? ? type : "#{type} of #{subtype.to_s.pluralize}" }
            last = options.pop
            options = options.join(', ') + " or #{last}"
            raise ArgumentError, "Value of '#{label}' passed to #{method} must be #{options}"
          end
        end
      end
    end
  end
end

View on GitHub (pinned to 6b05625475)

When it happens

Trigger: Thrown at app/services/foreman/renderer/scope/macros/loaders.rb:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of theforeman/foreman@6b05625475 (2026-08-23). Data as JSON: /api/errors/52a416e08899768a. Report an issue: GitHub.