we-promise/sure · warning · Provider::Realie::Error

Realie matched a property in a different city or ZIP code. P

Error message

Realie matched a property in a different city or ZIP code. Please double-check the address.

What it means

Raised in Provider::Realie#fetch_property_valuation when Realie returned candidate properties but none satisfied location_match?: each candidate's returned city/zipCode contradicted the entered locality/postal_code (case-insensitive city compare; ZIP compared on first 5 chars; a candidate matches when nothing contradicts). Because the API query matches on street + state ONLY (city filtering would additionally require a county the form doesn't collect), common street names resolve to properties in other cities — this error is the guard against syncing the wrong property's valuation.

Source

Thrown at app/models/provider/realie.rb:68

      # The address lookup endpoint accepts only the street address and
      # 2-letter state code — filtering by city additionally requires a
      # county, which the property address form doesn't collect.
      response = client.get("#{base_url}/api/public/property/address/") do |req|
        req.params["address"] = line1.to_s.strip
        req.params["state"] = region.to_s.strip.upcase
      end

      parsed = JSON.parse(response.body)
      records = parsed["property"]
      records = [ records ] unless records.is_a?(Array)
      records = records.reject(&:blank?)
      raise Error.new(I18n.t("providers.realie.errors.no_property")) if records.empty?

      # A street+state query can return several candidates across different
      # cities; pick the first one consistent with the entered city/ZIP.
      record = records.find { |candidate| location_match?(candidate, locality: locality, postal_code: postal_code) }
      raise Error.new(I18n.t("providers.realie.errors.location_mismatch")) if record.nil?

      # Realie returns modelValue: 0 when it couldn't produce an AVM
      # estimate, so zero counts as absent and falls back to the assessed
      # total market value.
      valuation = [ record["modelValue"], record["totalMarketValue"] ].find { |value| value.present? && value.to_d.positive? }
      raise Error.new(I18n.t("providers.realie.errors.no_valuation")) if valuation.nil?

      PropertyValuation.new(
        valuation: BigDecimal(valuation.to_s),
        currency: "USD",
        property_type: subtype_for_use_code(record["useCode"]),
        year_built: record["yearBuilt"],
        area_value: record["buildingArea"],
        area_unit: "sqft"
      )
    end
  end

View on GitHub (pinned to e69894adb9)

Solutions

  1. Have the user double-check city and ZIP against how the USPS formats the address (USPS lookup), then retry.
  2. Prefer ZIP over city when they conflict: pass the verified postal_code and treat locality as optional (location_match? only fails on contradiction — a blank entered city never mismatches).
  3. If multiple candidates are routine for your data, consider surfacing the candidate list for user selection instead of failing.
  4. Validate the ZIP is 5 digits and the state is a valid 2-letter code before the call.

Example fix

# before
realie.fetch_property_valuation(
  line1: "100 Main St", locality: "Brooklyn", region: "NY", postal_code: "11201"
) # record city 'New York' contradicts -> location_mismatch

# after
# USPS-style locality matches the assessor record's city
realie.fetch_property_valuation(
  line1: "100 Main St", locality: usps_city_for(address), region: "NY", postal_code: address.zip.first(5)
)
Defensive patterns

Strategy: validation

Validate before calling

# pre-verify the entered city/ZIP pair the way location_match? will judge it
zip = postal_code.to_s.strip.first(5)
raise ArgumentError, "5-digit ZIP required" unless zip.match?(/\A\d{5}\z/)
# USPS canonicalize so 'Brooklyn' becomes the assessor's city when needed
city = UspsLookup.city_for(zip) || locality.to_s.strip

Try / catch

begin
  valuation = realie.fetch_property_valuation(line1:, locality:, region:, postal_code:)
rescue Provider::Realie::Error => e
  raise unless e.message == I18n.t("providers.realie.errors.location_mismatch")
  # retry once with locality blank: ZIP alone still disambiguates
  realie.fetch_property_valuation(line1:, locality: nil, region:, postal_code:)
end

Prevention

When it happens

Trigger: '100 Main St' + 'TX' returning Main Streets in Dallas, Austin, and Houston while the user entered Houston; entered city or ZIP with a typo so every candidate 'contradicts'; user swapped city and ZIP fields; returned record has a different ZIP formatting (e.g. ZIP+4 handled via first(5)) that still mismatches on city.

Common situations: Apartment/duplex addresses where the entered city is actually the postal-service city but the record carries the incorporated city; users entering a neighborhood name (e.g. 'Brooklyn') where the record says 'New York'; stale ZIP from a previous address; addresses near city boundaries.

Related errors


AI-assisted analysis of we-promise/sure@e69894adb9 (2026-08-21). Data as JSON: /api/errors/73d2e38416b2630b. Report an issue: GitHub.