{"record":{"id":"1f4ad69054d74e33","repo":"OpenBB-finance/OpenBB","slug":"invalid-bill-type-values-bill-type-must-be-one","errorCode":null,"errorMessage":"Invalid bill_type: {values.bill_type}. Must be one of: {', '.join(BillTypes)}.","messagePattern":"Invalid bill_type: (.+?)\\. Must be one of: (.+?)\\.","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_bills.py","lineNumber":92,"sourceCode":"        default=None,\n        description=QUERY_DESCRIPTIONS.get(\"limit\", \"\")\n        + \" When None, default sets to 100 (max 250).\"\n        + \" Set to 0 for no limit (must be used with 'bill_type' and 'congress').\"\n        + \" Setting to 0 will nullify the start_date, end_date, and offset parameters.\",\n    )\n    offset: int | None = Field(\n        default=None, description=\"The starting record returned. 0 is the first record.\"\n    )\n    sort_by: Literal[\"asc\", \"desc\"] = Field(\n        default=\"desc\", description=\"Sort by update date. Default is latest first.\"\n    )\n\n    @model_validator(mode=\"after\")\n    @classmethod\n    def validate_query(cls, values):\n        \"\"\"Validate the query parameters.\"\"\"\n        if values.bill_type is not None and values.bill_type not in BillTypes:\n            raise OpenBBError(\n                ValueError(\n                    f\"Invalid bill_type: {values.bill_type}. Must be one of: {', '.join(BillTypes)}.\"\n                )\n            )\n        if values.limit == 0 and values.bill_type is None:\n            raise OpenBBError(\n                ValueError(\n                    \"'limit' cannot be set to 0 without 'bill_type' and 'congress'.\"\n                )\n            )\n        return values\n\n\nclass CongressBillsData(Data):\n    \"\"\"Congress Bills Data.\"\"\"\n\n    __alias_dict__ = {\n        \"bill_type\": \"type\",","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_bills.py#L74-L110","documentation":"OpenBBError from the CongressBillsQueryParams validator: bill_type, when supplied, must be one of the BillTypes codes ('hr', 's', 'hjres', 'sjres', 'hconres', 'sconres', 'hres', 'sres'). Raised during parameter validation before any request, with the full allowed list in the message.","triggerScenarios":"Calling obb.congress.bills(bill_type='house') or 'HR' (uppercase); passing the long title 'House Resolution' from a form; forwarding free-text user input.","commonSituations":"Case sensitivity ('HR' vs 'hr'); chamber names used instead of bill-type codes; autocomplete fields without constrained vocabularies.","solutions":["Use the lowercase Thomson-style code from the message, e.g. 'hr' or 's'.","Lowercase/strip input before passing: bill_type = bill_type.strip().lower().","Constrain UI fields to the eight valid codes."],"exampleFix":"# before\nobb.congress.bills(bill_type='House Resolution')\n\n# after\nobb.congress.bills(bill_type='hres')","handlingStrategy":"type-guard","validationCode":"BILL_TYPES = {'hr','s','hjres','sjres','hconres','sconres','hres','sres'}\nif bill_type is not None:\n    assert bill_type.strip().lower() in BILL_TYPES, f'use one of {sorted(BILL_TYPES)}'","typeGuard":"from typing import Literal\nBillType = Literal['hr','s','hjres','sjres','hconres','sconres','hres','sres']\n\ndef is_bill_type(v: str) -> bool:\n    return v in ('hr','s','hjres','sjres','hconres','sconres','hres','sres')","tryCatchPattern":null,"preventionTips":["Lowercase user input before mapping to bill-type codes.","Constrain pickers to the eight codes.","Reuse the error message's allowed list as your validation set."],"tags":["congress-gov","validation","query-params","bills","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}