{"record":{"id":"52a416e08899768a","repo":"theforeman/foreman","slug":"value-of-label-passed-to-method-must-be","errorCode":null,"errorMessage":"Value of '#{label}' passed to #{method} must be #{options}","messagePattern":"Value of '#(.+?)' passed to #(.+?) must be #(.+?)","errorType":"validation","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"app/services/foreman/renderer/scope/macros/loaders.rb","lineNumber":104,"sourceCode":"            base = base.search_for(search)\n            base = base.preload(preload) unless preload.nil?\n            base = base.includes(includes) unless includes.nil?\n            base = base.joins(joins) unless joins.nil?\n            base = base.authorized(permission) unless permission.nil?\n            base = base.limit(limit) unless limit.nil?\n            base = base.where(where) unless where.nil?\n            base = base.select(select) unless select.nil?\n            base.in_batches(of: batch)\n          end\n\n          def type_check!(method, label, what, spec)\n            return if what.nil?\n            return if spec.any? { |type, subtype| what.is_a?(type) && (subtype.nil? || what.all? { |value| value.is_a?(subtype) }) }\n\n            options = spec.map { |type, subtype| subtype.nil? ? type : \"#{type} of #{subtype.to_s.pluralize}\" }\n            last = options.pop\n            options = options.join(', ') + \" or #{last}\"\n            raise ArgumentError, \"Value of '#{label}' passed to #{method} must be #{options}\"\n          end\n        end\n      end\n    end\n  end\nend\n","sourceCodeStart":86,"sourceCodeEnd":111,"githubUrl":"https://github.com/theforeman/foreman/blob/6b05625475cfe6aac31a88f8c8ee6e62e4efe620/app/services/foreman/renderer/scope/macros/loaders.rb#L86-L111","documentation":"Error \"Value of '#{label}' passed to #{method} must be #{options}\" thrown in theforeman/foreman.","triggerScenarios":"Thrown at app/services/foreman/renderer/scope/macros/loaders.rb:104 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6b05625475cfe6aac31a88f8c8ee6e62e4efe620","analyzedAt":"2026-08-23T17:46:34.094Z","schemaVersion":2},"datasetVersion":"2026-08-23T21:17:23.414Z"}