{"record":{"id":"1eada04086e5085f","repo":"antiwork/gumroad","slug":"label-may-only-contain-allowed-description","errorCode":null,"errorMessage":"#{label} may only contain #{allowed_description}.","messagePattern":"#(.+?) may only contain #(.+?)\\.","errorType":"exception","errorClass":"StripeBeneficialOwnersManager::InvalidFieldError","httpStatus":422,"severity":"error","filePath":"app/business/payments/merchant_registration/implementations/stripe/stripe_beneficial_owners_manager.rb","lineNumber":215,"sourceCode":"    end\n\n    # The building number is often just digits and dashes (e.g. \"1-1\"), so only the town and\n    # city fields must actually contain katakana — matching the browser-side rules.\n    { street_address_kana: \"Town/Cho-me (Kana)\",\n      city_kana: \"City/Ward (Kana)\" }.each do |key, label|\n      value = address[key].to_s\n      next if value.blank?\n      next if value.match?(UserComplianceInfo::HAS_KATAKANA)\n      raise InvalidFieldError, \"#{label} must include katakana characters.\"\n    end\n  end\n  private_class_method :validate_jp_kana_address_format!\n\n  def self.validate_kana_param!(value, label, regex, allowed_description)\n    value = value.to_s\n    return if value.blank?\n    return if value.match?(regex)\n    raise InvalidFieldError, \"#{label} may only contain #{allowed_description}.\"\n  end\n  private_class_method :validate_kana_param!\n\n  # The form's maxLength counts characters so a pasted \"1.123.456.789\" fits, which means a value can\n  # satisfy the input and still carry too few digits. Checking digits here — and normalizing in\n  # build_person_params — keeps this path from handing Stripe a number it will refuse, which is the\n  # rolled-back-create failure that left one seller with eight silent attempts.\n  def self.validate_colombia_id_number!(params, user)\n    return unless user.alive_user_compliance_info&.legal_entity_country_code == Compliance::Countries::COL.alpha2\n    id_number = params[:id_number].to_s\n    return if id_number.strip.blank?\n    return if Compliance::ColombiaIdNumber.valid?(id_number)\n    raise InvalidFieldError, Compliance::ColombiaIdNumber::ERROR_MESSAGE\n  end\n  private_class_method :validate_colombia_id_number!\n\n  def self.representative?(person)\n    relationship = person.is_a?(Hash) ? person[:relationship] || person[\"relationship\"] : person[:relationship]","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/antiwork/gumroad/blob/afeacbd394069a1cbf0c6c50ee8e900925050370/app/business/payments/merchant_registration/implementations/stripe/stripe_beneficial_owners_manager.rb#L197-L233","documentation":"InvalidFieldError from StripeBeneficialOwnersManager.validate_kana_param!, the generic character-whitelist check used for the Japanese kana name/address fields (katakana, latin characters, digits, spaces, dashes, and dots — per UserComplianceInfo::KANA_ADDRESS_REGEX / kana regexes). Blank values pass; any value containing characters outside the allowed set raises with the human-readable allowed_description. It is the counterpart of the 'must include katakana' rule: this one restricts the alphabet, that one requires katakana presence.","triggerScenarios":"Submitting a JP beneficial-owner kana field (name_kana, or kana address keys like street_address_kana/block/building) containing characters outside the whitelist — e.g. kanji, full-width punctuation like '、', commas, apostrophes, or emoji.","commonSituations":"Users typing kanji or half-width punctuation into kana fields; copy-paste from documents with full-width forms; forms not enforcing the same input pattern client-side so the server raise surprises the user.","solutions":["Re-enter the value using only the allowed characters listed in the message (katakana, latin, digits, spaces, dashes, dots) and resubmit.","Match your front-end input validation to the same regex so the user is stopped before submit.","Normalize input before send: strip full-width punctuation (、，「」etc.) or transliterate kanji to kana.","Leave optional kana fields blank instead of filling them with placeholder text like 'N/A' (dashes/dots are fine, slashes are not)."],"exampleFix":"# before: kanji + full-width comma fails the whitelist\nparams[:name_kana] = \"山田、タロウ\"\n# after: katakana + whitelisted separators only\nparams[:name_kana] = \"ヤマダ タロウ\"","handlingStrategy":"validation","validationCode":"return if value.blank?\nunless value.match?(UserComplianceInfo::KANA_ADDRESS_REGEX)\n  Result.invalid(\"#{label}: only katakana, latin, digits, spaces, dashes, dots\")\nend","typeGuard":"def kana_whitelist_ok?(value)\n  value.to_s.blank? || value.to_s.match?(UserComplianceInfo::KANA_ADDRESS_REGEX)\nend","tryCatchPattern":null,"preventionTips":["Mirror the server's whitelist regex in client validation.","Normalize full-width punctuation to whitelisted separators before submit.","Test with pasted real-world JP addresses (they carry full-width commas) before shipping forms."],"tags":["stripe","japan","katakana","kyc","beneficial-owners","localization","validation"],"backgroundTag":"locale-specific-field-validation","analyzedSha":"afeacbd394069a1cbf0c6c50ee8e900925050370","analyzedAt":"2026-08-21T17:58:52.159Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}