{"record":{"id":"13e01903e0fe6854","repo":"faker-ruby/faker","slug":"familial-connections-can-be-left-blank-or-famili","errorCode":null,"errorMessage":"Familial connections can be left blank or #{familial_connections.join(', ')}","messagePattern":"Familial connections can be left blank or #(.+?)","errorType":"exception","errorClass":"ArgumentError","httpStatus":null,"severity":"error","filePath":"lib/faker/default/relationship.rb","lineNumber":26,"sourceCode":"      ##\n      # Produces a random family relationship.\n      #\n      # @return [String]\n      #\n      # @example\n      #   Faker::Relationship.familial #=> \"Grandfather\"\n      #\n      # @faker.version 1.9.2\n      def familial(connection: nil)\n        familial_connections = translate('faker.relationship.familial').keys\n\n        if connection.nil?\n          connection = sample(familial_connections).to_s\n        else\n          connection = connection.to_s.downcase\n\n          unless familial_connections.include?(connection.to_sym)\n            raise ArgumentError,\n                  \"Familial connections can be left blank or #{familial_connections.join(', ')}\"\n          end\n        end\n\n        fetch(\"relationship.familial.#{connection}\")\n      end\n\n      ##\n      # Produces a random in-law relationship.\n      #\n      # @return [String]\n      #\n      # @example\n      #   Faker::Relationship.in_law #=> \"Brother-in-law\"\n      #\n      # @faker.version 1.9.2\n      def in_law\n        fetch('relationship.in_law')","sourceCodeStart":8,"sourceCodeEnd":44,"githubUrl":"https://github.com/faker-ruby/faker/blob/cca4184947e09fdd02afb8b89d25a9c8ebc7274e/lib/faker/default/relationship.rb#L8-L44","documentation":"Raised by Faker::Relationship.familial when the connection: argument, after downcasing, is not one of the keys under the faker.relationship.familial locale data (e.g. grandfather, grandmother, father, mother, son, daughter, brother, sister... depending on locale). Input is normalized with to_s.downcase, so 'Grandfather' works, but any unknown relation such as 'cousin' or 'aunt' raises ArgumentError listing the allowed connections.","triggerScenarios":"Faker::Relationship.familial(connection: 'cousin') or connection: :second_cousin raises when that key is absent from the loaded locale's relationship.familial section; connection: nil (default) samples a random one and never raises.","commonSituations":"Assuming the generator covers the full family tree (cousins/aunts/uncles are commonly missing); locale packs that ship a smaller familial set than en; passing values from a domain enum that is broader than Faker's list.","solutions":["Call with connection: nil to get a random familial connection.","Pass one of the listed (case-insensitive) connections such as 'grandfather' or :sister.","Inspect the accepted set at runtime: Faker::Relationship.familial and mirror on the error message, or read the keys from the locale YAML."],"exampleFix":"# before\nFaker::Relationship.familial(connection: 'cousin') # ArgumentError (not in data)\n\n# after\nFaker::Relationship.familial # random\nFaker::Relationship.familial(connection: 'grandfather')","handlingStrategy":"validation","validationCode":"allowed = Faker::Relationship.familial_methods rescue nil\n# simpler: read the locale keys directly\nallowed = I18n.translate('faker.relationship.familial').keys.map(&:to_s)\nFaker::Relationship.familial(connection: connection) if allowed.include?(connection.to_s.downcase)","typeGuard":"def known_familial_connection?(connection)\n  I18n.translate('faker.relationship.familial').key?(connection.to_s.downcase.to_sym)\nend","tryCatchPattern":"begin\n  Faker::Relationship.familial(connection: connection)\nrescue ArgumentError\n  Faker::Relationship.familial # random fallback\nend","preventionTips":["Case does not matter (input is downcased), but the key must exist in the locale.","Validate against I18n.translate('faker.relationship.familial').keys, not a guessed family-tree list.","Remember available connections vary with the loaded locale."],"tags":["faker","argument-error","enum-whitelist","relationship","locale-data"],"backgroundTag":"invalid-enum-argument","analyzedSha":"cca4184947e09fdd02afb8b89d25a9c8ebc7274e","analyzedAt":"2026-08-21T16:25:39.145Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}