OpenBB-finance/OpenBB · error · OpenBBError
Invalid amendment_type: {values.amendment_type}. Must be one
Error message
Invalid amendment_type: {values.amendment_type}. Must be one of: {', '.join(AmendmentTypes)}. What it means
OpenBBError from a pydantic model_validator on CongressAmendmentsQueryParams: the optional amendment_type must be one of the AmendmentTypes constants (e.g. 'hamdt', 'samdt') when provided. Raised at parameter-validation time, before any HTTP request, with the allowed list embedded in the message.
Source
Thrown at openbb_platform/providers/congress_gov/openbb_congress_gov/models/congress_amendments.py:83
description="Maximum number of results to return. When None, defaults to 100 (max 250)."
+ " Set to 0 for no limit (must be used with 'amendment_type').",
)
offset: int | None = Field(
default=None, description="The starting record returned. 0 is the first record."
)
sort_by: Literal["asc", "desc"] = Field(
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",View on GitHub (pinned to 3e071fcc2c)
Solutions
- Use one of the codes listed in the error message (e.g. 'hamdt' for House amendments, 'samdt' for Senate).
- Confirm the exact set via the endpoint's parameter docs or AmendmentTypes in openbb_congress_gov.models.congress_amendments.
- Constrain your own inputs to a Literal/dropdown of valid codes.
Example fix
# before obb.congress.amendments(amendment_type='house-amendment') # after obb.congress.amendments(amendment_type='hamdt')
Defensive patterns
Strategy: type-guard
Validate before calling
AMENDMENT_TYPES = {'hamdt', 'samdt'}
if amendment_type is not None:
assert amendment_type in AMENDMENT_TYPES, f'use one of {AMENDMENT_TYPES}' Type guard
from typing import Literal
AmendmentType = Literal['hamdt', 'samdt']
def is_amendment_type(v: str) -> bool:
return v in ('hamdt', 'samdt') Prevention
- Use the provider's type codes, not chamber names or long titles.
- Drive amendment_type from a dropdown limited to valid codes.
- Check the error message itself: it lists every allowed value.
When it happens
Trigger: Calling obb.congress.amendments with amendment_type='house' or 'h'amdt'' instead of 'hamdt'; passing the long form 'House Amendment' from a UI; forwarding an unvalidated user string.
Common situations: Not reading the allowed-values list in the message/docs; mixing up chamber names with amendment-type codes; data-entry fields without constrained inputs.
Related errors
- 'limit' cannot be set to 0 without 'amendment_type'.
- 'congress' is required when 'limit' is set to 0.
- Invalid bill_type: {values.bill_type}. Must be one of: {', '
- vx_type must be one of: 'am', 'eod'
- {error.get('code', '')} -> {error.get('message', '')}
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/c5f6a5a9088b194f.
Report an issue: GitHub.