OpenBB-finance/OpenBB · error · OpenBBError
'limit' cannot be set to 0 without 'amendment_type'.
Error message
'limit' cannot be set to 0 without 'amendment_type'.
What it means
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.
Source
Thrown at openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_amendments.py:90
default="desc", description="Sort by update date. Default is latest first."
)
@model_validator(mode="after")
@classmethod
def validate_query(cls, values):
"""Validate the query parameters."""
if (
values.amendment_type is not None
and values.amendment_type not in AmendmentTypes
):
raise OpenBBError(
ValueError(
f"Invalid amendment_type: {values.amendment_type}."
f" Must be one of: {', '.join(AmendmentTypes)}."
)
)
if values.limit == 0 and values.amendment_type is None:
raise OpenBBError(
ValueError("'limit' cannot be set to 0 without 'amendment_type'.")
)
return values
class CongressAmendmentsData(Data):
"""Congress Amendments Data."""
__alias_dict__ = {
"amendment_type": "type",
"amendment_url": "url",
}
model_config = ConfigDict(
json_schema_extra={
"x-widget_config": {
"$.name": "Congressional Amendments",
"$.category": "Government",View on GitHub (pinned to 3e071fcc2c)
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').
Example fix
# before obb.congress.amendments(limit=0) # after obb.congress.amendments(amendment_type='hamdt', limit=0)
Defensive patterns
Strategy: validation
Validate before calling
if limit == 0 and amendment_type is None:
raise ValueError('limit=0 requires amendment_type — choose hamdt or samdt') Prevention
- 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.
When it happens
Trigger: Calling obb.congress.amendments(limit=0) with no amendment_type; treating 0 as 'default limit' or 'no limit' without reading the sentinel semantics.
Common situations: Numeric input fields defaulting to 0; users assuming limit=0 means 'unlimited everything'; copied snippets where amendment_type was removed but limit=0 stayed.
Related errors
- Invalid amendment_type: {values.amendment_type}. Must be one
- 'congress' is required when 'limit' is set to 0.
- 'limit' cannot be set to 0 without 'bill_type' and 'congress
- {error.get('code', '')} -> {error.get('message', '')}
- Invalid bill_type: {values.bill_type}. Must be one of: {', '
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/051d2c2b94a0c88b.
Report an issue: GitHub.