{"record":{"id":"5c62188df07d0f9e","repo":"OpenBB-finance/OpenBB","slug":"invalid-amendment-type-amendment-type-must-be","errorCode":null,"errorMessage":"Invalid amendment type: {amendment_type}. Must be one of {', '.join(AmendmentTypes)}.","messagePattern":"Invalid amendment type: (.+?)\\. Must be one of (.+?)\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/utils/helpers.py","lineNumber":658,"sourceCode":"    end_date : Optional[str]\n        The end date in ISO format (YYYY-MM-DD) for filtering by updateDate.\n    limit : Optional[int]\n        The maximum number of amendments to return. Defaults to 100 if None.\n    offset : Optional[int]\n        The number of results to skip before starting to collect the result set.\n    sort_by : Literal[\"asc\", \"desc\"]\n        The sort order for the results. Defaults to \"desc\".\n\n    Returns\n    -------\n    dict\n        A dictionary of the raw JSON response from the API.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    from openbb_core.provider.utils.helpers import amake_request\n\n    if amendment_type is not None and amendment_type not in AmendmentTypes:\n        raise ValueError(\n            f\"Invalid amendment type: {amendment_type}. Must be one of {', '.join(AmendmentTypes)}.\"\n        )\n\n    api_key = check_api_key()\n    url = f\"{base_url}amendment\"\n\n    if congress is not None:\n        url += f\"/{congress}\"\n\n        if amendment_type is not None:\n            url += f\"/{amendment_type}\"\n\n    url += (f\"?fromDateTime={start_date + 'T00:00:00Z'}\" if start_date else \"\") + (\n        f\"&toDateTime={end_date + 'T23:59:59Z'}\" if end_date else \"\"\n    )\n    url += (\n        f\"{'?' if '?' not in url else '&'}\"\n        + f\"limit={limit if limit is not None else 100}\"","sourceCodeStart":640,"sourceCodeEnd":676,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/utils/helpers.py#L640-L676","documentation":"get_amendments validates the optional amendment_type against AmendmentTypes ('hamdt' = House amendment, 'samdt' = Senate amendment, 'suamdt' = Senate unprinted amendment) before building the /amendment URL. None is allowed (fetches all types); any other value raises ValueError. Case-sensitive.","triggerScenarios":"amendment_type='house'; 'HAMDT' (uppercase); a bill type like 'hres'; whitespace-padded 'samdt '.","commonSituations":"Users spelling out chamber names instead of codes; mixing bill/law/amendment taxonomies; unnormalized UI input.","solutions":["Use 'hamdt', 'samdt', 'suamdt', or None","Normalize input: amendment_type.strip().lower() at the boundary","Map display labels ('House Amendment' -> 'hamdt') in your adapter layer"],"exampleFix":"# before\namds = await get_amendments(congress=118, amendment_type='Senate Amendment')\n\n# after\namds = await get_amendments(congress=118, amendment_type='samdt')","handlingStrategy":"validation","validationCode":"from openbb_congress_gov.utils.constants import AmendmentTypes\n\ndef normalize_amendment_type(at: str | None) -> str | None:\n    if at is None:\n        return None\n    at = at.strip().lower()\n    assert at in AmendmentTypes, f'Invalid amendment type {at!r}; use {AmendmentTypes}'\n    return at","typeGuard":"def is_valid_amendment_type(at: str | None) -> bool:\n    return at is None or at.strip().lower() in ('hamdt', 'samdt', 'suamdt')","tryCatchPattern":null,"preventionTips":["Use codes not words: hamdt/samdt/suamdt, not 'House Amendment'","None is valid here (all types) — case-sensitive otherwise","Keep bill/law/amendment enums separate in your code"],"tags":["congress-gov","validation","amendment-type","case-sensitivity"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}