we-promise/sure · error · Property::AvmImport::Error

{e.record.errors.full_messages.to_sentence.presence || e.mes

Error message

{e.record.errors.full_messages.to_sentence.presence || e.message}

What it means

Setting::ValidationError raised by Setting.validate_openai_config! when a custom OpenAI-compatible URI base (openai_uri_base) is set but openai_model is blank. When you point the instance at a custom/proxy endpoint, the provider no longer knows which model to request, so a model name is mandatory. Passing explicit uri_base:/model: kwargs validates the prospective pair; omitting them validates the currently stored settings.

Source

Thrown at app/models/property/avm_import.rb:71

          area_unit: data.area_unit,
          avm_provider: provider_key,
          avm_last_synced_on: Date.current,
          # Providers only cover US addresses, so the country isn't collected
          # in the lookup form. "US" matches the manual form's placeholder.
          address_attributes: address_attributes.merge(country: "US")
        )
      )

      result = account.set_current_balance(data.valuation)
      raise Error.new(result.error) unless result.success?

      account.activate!
    end

    account.auto_share_with_family! if family.share_all_by_default?
    account
  rescue ActiveRecord::RecordInvalid => e
    raise Error.new(e.record.errors.full_messages.to_sentence.presence || e.message)
  end

  private
    attr_reader :family, :owner, :provider_key, :name, :address_attributes

    # The form marks these required, but a forged or JS-less submission can
    # bypass that — validate locally before spending a monthly-budget request
    # on a lookup that can't produce a property.
    def validate_inputs!
      missing = name.blank? ||
        %i[line1 locality region postal_code].any? { |field| address_attributes[field].blank? }

      raise Error.new(I18n.t("providers.property_valuation.missing_fields")) if missing
    end
end

View on GitHub (pinned to e69894adb9)

Solutions

  1. Set an openai_model appropriate for your endpoint (e.g., gpt-4o-mini for OpenAI, or your proxy's model alias) together with the URI base
  2. If the settings update is split across requests, validate the pair with validate_openai_config!(uri_base:, model:) before persisting either field
  3. Clear openai_uri_base if you want the official endpoint and default model behavior
  4. In the UI, make the model field required when a custom base is present

Example fix

# before
Setting.openai_uri_base = "https://llmm.example.com/v1"
Setting.openai_model = ""

# after
Setting.validate_openai_config!(uri_base: "https://llmm.example.com/v1", model: "gpt-4o-mini")
Setting.openai_uri_base = "https://llmm.example.com/v1"
Setting.openai_model = "gpt-4o-mini"
Defensive patterns

Strategy: validation

Validate before calling

Setting.validate_openai_config!(uri_base: proposed_uri_base, model: proposed_model) # call BEFORE persisting

Prevention

When it happens

Trigger: Saving host settings with openai_uri_base filled (e.g., a LiteLLM/OpenRouter/ollama proxy URL) but openai_model left empty; updating uri_base first in a two-step form where the model field is saved later; clearing the model field while a custom base remains.

Common situations: Self-hosters switching from api.openai.com to a local gateway and forgetting the model dropdown; API updates that send uri_base without model; forms where the model field is conditionally hidden.

Related errors


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