{"record":{"id":"f6527ef4a327a78d","repo":"faker-ruby/faker","slug":"size-should-be-specified-in-format-300x300-f6527e","errorCode":null,"errorMessage":"Size should be specified in format 300x300","messagePattern":"Size should be specified in format 300x300","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/faker/default/lorem_flickr.rb","lineNumber":99,"sourceCode":"      # @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\nend\n","sourceCodeStart":81,"sourceCodeEnd":111,"githubUrl":"https://github.com/faker-ruby/faker/blob/cca4184947e09fdd02afb8b89d25a9c8ebc7274e/lib/faker/default/lorem_flickr.rb#L81-L111","documentation":"Raised by the private Faker::LoremFlickr.build_url (used by image, grayscale_image, pixelated_image, colorized_image) when the size string does not match /\\A[0-9]+x[0-9]+\\z/ — i.e. anything other than digits, a literal 'x', digits. The URL path needs the width and height as separate segments, so malformed sizes like '300', '300x', '300X300', '300 x 300', or '300.5x200' are rejected.","triggerScenarios":"Faker::LoremFlickr.image(size: '300') or size: '100*100', size: '50X60' (capital X), size: '50x60 ' (trailing space) raises 'Size should be specified in format 300x300'.","commonSituations":"Composing size from variables: \"#{w}x#{h}\" when one side is nil gives '300x'; accepting dimensions from user input or config without normalization; using '×' (Unicode multiplication sign) instead of ASCII 'x'.","solutions":["Pass size as digits-x-digits, e.g. size: '300x300' or size: \"#{width}x#{height}\".","Normalize before calling: size = \"#{width.to_i}x#{height.to_i}\" to strip whitespace/nil.","Validate with the same regex in the calling layer: size =~ /\\A[0-9]+x[0-9]+\\z/."],"exampleFix":"# before\nFaker::LoremFlickr.image(size: \"#{width} x #{height}\") # ArgumentError\n\n# after\nFaker::LoremFlickr.image(size: \"#{width.to_i}x#{height.to_i}\")","handlingStrategy":"validation","validationCode":"size = \"#{width.to_i}x#{height.to_i}\"\nraise ArgumentError, 'bad size' unless size =~ /\\A[0-9]+x[0-9]+\\z/\nFaker::LoremFlickr.image(size: size, search_terms: terms)","typeGuard":"def valid_loremflickr_size?(size)\n  size.is_a?(String) && size.match?(/\\A[0-9]+x[0-9]+\\z/)\nend","tryCatchPattern":"begin\n  Faker::LoremFlickr.image(size: size)\nrescue ArgumentError\n  Faker::LoremFlickr.image # default 300x300\nend","preventionTips":["Always interpolate dimensions with to_i so nil never reaches the string.","Use ASCII lowercase 'x', never 'X' or Unicode multiplication signs.","Keep one size-formatting helper for all placeholder image gems you use."],"tags":["faker","argument-error","format-validation","image-url","regex"],"backgroundTag":"invalid-format-argument","analyzedSha":"cca4184947e09fdd02afb8b89d25a9c8ebc7274e","analyzedAt":"2026-08-21T16:25:39.145Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}