{"record":{"id":"f4cf2cc9d3df05f3","repo":"we-promise/sure","slug":"e-record-errors-full-messages-to-sentence-presenc","errorCode":null,"errorMessage":"{e.record.errors.full_messages.to_sentence.presence || e.message}","messagePattern":"\\{e\\.record\\.errors\\.full_messages\\.to_sentence\\.presence \\|\\| e\\.message\\}","errorType":"validation","errorClass":"Property::AvmImport::Error","httpStatus":null,"severity":"error","filePath":"app/models/property/avm_import.rb","lineNumber":71,"sourceCode":"          area_unit: data.area_unit,\n          avm_provider: provider_key,\n          avm_last_synced_on: Date.current,\n          # Providers only cover US addresses, so the country isn't collected\n          # in the lookup form. \"US\" matches the manual form's placeholder.\n          address_attributes: address_attributes.merge(country: \"US\")\n        )\n      )\n\n      result = account.set_current_balance(data.valuation)\n      raise Error.new(result.error) unless result.success?\n\n      account.activate!\n    end\n\n    account.auto_share_with_family! if family.share_all_by_default?\n    account\n  rescue ActiveRecord::RecordInvalid => e\n    raise Error.new(e.record.errors.full_messages.to_sentence.presence || e.message)\n  end\n\n  private\n    attr_reader :family, :owner, :provider_key, :name, :address_attributes\n\n    # The form marks these required, but a forged or JS-less submission can\n    # bypass that — validate locally before spending a monthly-budget request\n    # on a lookup that can't produce a property.\n    def validate_inputs!\n      missing = name.blank? ||\n        %i[line1 locality region postal_code].any? { |field| address_attributes[field].blank? }\n\n      raise Error.new(I18n.t(\"providers.property_valuation.missing_fields\")) if missing\n    end\nend\n","sourceCodeStart":53,"sourceCodeEnd":87,"githubUrl":"https://github.com/we-promise/sure/blob/e69894adb92547273377398c15f45c979cd9416a/app/models/property/avm_import.rb#L53-L87","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["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","If the settings update is split across requests, validate the pair with validate_openai_config!(uri_base:, model:) before persisting either field","Clear openai_uri_base if you want the official endpoint and default model behavior","In the UI, make the model field required when a custom base is present"],"exampleFix":"# before\nSetting.openai_uri_base = \"https://llmm.example.com/v1\"\nSetting.openai_model = \"\"\n\n# after\nSetting.validate_openai_config!(uri_base: \"https://llmm.example.com/v1\", model: \"gpt-4o-mini\")\nSetting.openai_uri_base = \"https://llmm.example.com/v1\"\nSetting.openai_model = \"gpt-4o-mini\"","handlingStrategy":"validation","validationCode":"Setting.validate_openai_config!(uri_base: proposed_uri_base, model: proposed_model) # call BEFORE persisting","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always submit openai_uri_base and openai_model together in one settings update","Make the model field required in UI when a custom base is entered","Validate prospective pairs with validate_openai_config!(uri_base:, model:) before writing either field"],"tags":["settings","openai","configuration","validation","llm"],"backgroundTag":"missing-required-config","analyzedSha":"e69894adb92547273377398c15f45c979cd9416a","analyzedAt":"2026-08-21T18:22:41.165Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}