{"record":{"id":"051d2c2b94a0c88b","repo":"OpenBB-finance/OpenBB","slug":"limit-cannot-be-set-to-0-without-amendment-type","errorCode":null,"errorMessage":"'limit' cannot be set to 0 without 'amendment_type'.","messagePattern":"'limit' cannot be set to 0 without 'amendment_type'\\.","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_amendments.py","lineNumber":90,"sourceCode":"        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 (\n            values.amendment_type is not None\n            and values.amendment_type not in AmendmentTypes\n        ):\n            raise OpenBBError(\n                ValueError(\n                    f\"Invalid amendment_type: {values.amendment_type}.\"\n                    f\" Must be one of: {', '.join(AmendmentTypes)}.\"\n                )\n            )\n        if values.limit == 0 and values.amendment_type is None:\n            raise OpenBBError(\n                ValueError(\"'limit' cannot be set to 0 without 'amendment_type'.\")\n            )\n        return values\n\n\nclass CongressAmendmentsData(Data):\n    \"\"\"Congress Amendments Data.\"\"\"\n\n    __alias_dict__ = {\n        \"amendment_type\": \"type\",\n        \"amendment_url\": \"url\",\n    }\n\n    model_config = ConfigDict(\n        json_schema_extra={\n            \"x-widget_config\": {\n                \"$.name\": \"Congressional Amendments\",\n                \"$.category\": \"Government\",","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_amendments.py#L72-L108","documentation":"OpenBBError from the same query-params validator: limit=0 is a sentinel meaning 'fetch ALL amendments of a given type across congresses', which is only meaningful together with amendment_type. Setting limit=0 with amendment_type=None is contradictory (all of nothing) and rejected up front.","triggerScenarios":"Calling obb.congress.amendments(limit=0) with no amendment_type; treating 0 as 'default limit' or 'no limit' without reading the sentinel semantics.","commonSituations":"Numeric input fields defaulting to 0; users assuming limit=0 means 'unlimited everything'; copied snippets where amendment_type was removed but limit=0 stayed.","solutions":["Either omit limit / set a positive number for a paged listing, or supply amendment_type along with limit=0.","If you intended 'all House amendments', call amendments(limit=0, amendment_type='hamdt')."],"exampleFix":"# before\nobb.congress.amendments(limit=0)\n\n# after\nobb.congress.amendments(amendment_type='hamdt', limit=0)","handlingStrategy":"validation","validationCode":"if limit == 0 and amendment_type is None:\n    raise ValueError('limit=0 requires amendment_type — choose hamdt or samdt')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat limit=0 as 'fetch all of a type', never as 'default'.","Never let numeric inputs default to 0 when calling congress endpoints.","Document the sentinel in your own wrappers so callers do not rediscover it."],"tags":["congress-gov","validation","limit","amendments","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}