{"record":{"id":"3bcfcad496e6dd8b","repo":"faker-ruby/faker","slug":"supported-colorizations-are-supported-colorizati","errorCode":null,"errorMessage":"Supported colorizations are #{SUPPORTED_COLORIZATIONS.join(', ')}","messagePattern":"Supported colorizations are #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/faker/default/lorem_flickr.rb","lineNumber":91,"sourceCode":"      # Produces a random colorized image URL from loremflickr.com.\n      #\n      # @param size [String] Specifies the size of image to generate.\n      # @param color [String] Specifies the color of image to generate.\n      # @param search_terms [Array<String>] Adds search terms to the image URL.\n      # @param match_all [Boolean] Add \"all\" as part of the URL.\n      # @return [String]\n      #\n      # @example\n      #   Faker::LoremFlickr.image #=> \"https://loremflickr.com/red/300/300/all\"\n      #   Faker::LoremFlickr.image(size: \"50x60\", color: 'blue') #=> \"https://loremflickr.com/blue/50/60/all\"\n      #   Faker::LoremFlickr.image(size: \"50x60\", color: 'blue', search_terms: ['sports']) #=> \"https://loremflickr.com/blue/50/60/sports\"\n      #   Faker::LoremFlickr.image(size: \"50x60\", color: 'blue', search_terms: ['sports', 'fitness']) #=> \"https://loremflickr.com/blue/50/60/sports,fitness\"\n      #   Faker::LoremFlickr.image(size: \"50x60\", color: 'blue', search_terms: ['sports', 'fitness'], match_all: true) #=> \"https://loremflickr.com/blue/50/60/sports,fitness/all\"\n      #\n      # @faker.version 1.9.0\n      def colorized_image(size: '300x300', color: 'red', search_terms: ['all'], match_all: false)\n        raise ArgumentError, 'Search terms must be specified for colorized images' unless search_terms.any?\n        raise ArgumentError, \"Supported colorizations are #{SUPPORTED_COLORIZATIONS.join(', ')}\" unless SUPPORTED_COLORIZATIONS.include?(color)\n\n        build_url(size, color, search_terms, match_all)\n      end\n\n      private\n\n      def build_url(size, format, search_terms, match_all)\n        raise ArgumentError, 'Size should be specified in format 300x300' unless size =~ /\\A[0-9]+x[0-9]+\\z/\n\n        url_parts = ['https://loremflickr.com']\n        url_parts << format\n        url_parts += size.split('x')\n        url_parts << search_terms.compact.join(',') if search_terms.any?\n        url_parts << 'all' if match_all\n        url_parts.compact.join('/')\n      end\n    end\n  end","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/faker-ruby/faker/blob/cca4184947e09fdd02afb8b89d25a9c8ebc7274e/lib/faker/default/lorem_flickr.rb#L73-L109","documentation":"Raised by Faker::LoremFlickr.colorized_image when color is not one of the SUPPORTED_COLORIZATIONS: 'red', 'green', 'blue'. The check is an exact include? on the frozen whitelist, so case and type matter — :red works only as the string 'red'; 'Red', 'red '.strip issues, or symbols like :blue raise.","triggerScenarios":"Faker::LoremFlickr.colorized_image(color: 'red', search_terms: ['cats']) is fine; color: 'purple', 'Red', or :green raises at lib/faker/default/lorem_flickr.rb:91 with the message listing 'red, green, blue'.","commonSituations":"Passing arbitrary CSS color names from a UI theme picker into Faker; assuming symbols work because other Faker generators accept symbols; copying the whitelist from a newer/older faker version where the set differs.","solutions":["Use exactly 'red', 'green', or 'blue' (lowercase strings) for color.","Downcase and validate user/theme input against Faker::LoremFlickr::SUPPORTED_COLORIZATIONS before calling.","If the desired tint is unsupported, use Faker::LoremFlickr.image without a color instead."],"exampleFix":"# before\nFaker::LoremFlickr.colorized_image(color: 'Red', search_terms: ['cats']) # ArgumentError\n\n# after\nFaker::LoremFlickr.colorized_image(color: 'red', search_terms: ['cats'])","handlingStrategy":"type-guard","validationCode":"color = color.to_s.downcase\ncolor = 'red' unless Faker::LoremFlickr::SUPPORTED_COLORIZATIONS.include?(color)\nFaker::LoremFlickr.colorized_image(color: color, search_terms: terms)","typeGuard":"def supported_colorization?(color)\n  Faker::LoremFlickr::SUPPORTED_COLORIZATIONS.include?(color.to_s.downcase)\nend","tryCatchPattern":"begin\n  Faker::LoremFlickr.colorized_image(color: color, search_terms: terms)\nrescue ArgumentError\n  Faker::LoremFlickr.colorized_image(color: 'red', search_terms: terms)\nend","preventionTips":["Reference the constant Faker::LoremFlickr::SUPPORTED_COLORIZATIONS instead of hardcoding the list.","Downcase theme/UI colors before passing.","Remember only lowercase strings 'red', 'green', 'blue' are accepted — not symbols."],"tags":["faker","argument-error","enum-whitelist","image-url","loremflickr"],"backgroundTag":"invalid-enum-argument","analyzedSha":"cca4184947e09fdd02afb8b89d25a9c8ebc7274e","analyzedAt":"2026-08-21T16:25:39.145Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}