{"record":{"id":"db328b850841e94b","repo":"OpenBB-finance/OpenBB","slug":"limit-cannot-be-set-to-0-without-bill-type-and","errorCode":null,"errorMessage":"'limit' cannot be set to 0 without 'bill_type' and 'congress'.","messagePattern":"'limit' cannot be set to 0 without 'bill_type' and 'congress'\\.","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_bills.py","lineNumber":98,"sourceCode":"    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\",\n        \"bill_number\": \"number\",\n        \"bill_url\": \"url\",\n    }\n\n    model_config = ConfigDict(\n        json_schema_extra={","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_bills.py#L80-L116","documentation":"OpenBBError from the same bills validator: limit=0 is the 'fetch all bills of a type' sentinel and requires bill_type to be set (and, per the fetcher, a congress). limit=0 with bill_type=None is rejected at validation time because there is no enumerable target.","triggerScenarios":"Calling obb.congress.bills(limit=0) alone; UIs sending 0 as their numeric default; removing bill_type from a copied call while keeping limit=0.","commonSituations":"Treating 0 as 'no limit'; form defaults of 0; misunderstandings of the sentinel convention.","solutions":["Pair limit=0 with bill_type (and congress at fetch time), e.g. bills(congress=119, bill_type='hr', limit=0).","Or set a positive limit for a normal paged listing."],"exampleFix":"# before\nobb.congress.bills(limit=0)\n\n# after\nobb.congress.bills(congress=119, bill_type='hr', limit=0)","handlingStrategy":"validation","validationCode":"if limit == 0:\n    assert bill_type is not None, 'limit=0 requires bill_type (and congress in the fetcher)'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat limit=0 as the 'fetch all of a type' sentinel only.","Use a positive limit for ordinary listings.","Guard numeric defaults so 0 never reaches congress endpoints accidentally."],"tags":["congress-gov","validation","limit","bills","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}