{"record":{"id":"76b07a07de9b4aba","repo":"OpenBB-finance/OpenBB","slug":"amendment-url-is-required-please-provide-a-valid","errorCode":null,"errorMessage":"Amendment URL is required. Please provide a valid amendment shorthand (e.g., '119/hamdt/2').","messagePattern":"Amendment URL is required\\. Please provide a valid amendment shorthand \\(e\\.g\\., '119/hamdt/2'\\)\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/router/congress_gov_router.py","lineNumber":359,"sourceCode":") -> list:\n    \"\"\"Get document choices for a specific amendment.\n\n    This function is used by the Congressional Amendment Viewer widget, in OpenBB Workspace,\n    to populate document choices for the selected amendment.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    from openbb_congress_gov.utils.helpers import get_amendment_text_choices\n\n    if not amendment_url and is_workspace is True:\n        return [\n            {\n                \"label\": \"Enter a valid amendment URL to view available documents.\",\n                \"value\": \"\",\n            }\n        ]\n\n    if not amendment_url:\n        raise HTTPException(\n            status_code=500,\n            detail=\"Amendment URL is required. Please provide a valid amendment shorthand (e.g., '119/hamdt/2').\",\n        )\n\n    return await get_amendment_text_choices(\n        amendment_url=amendment_url, is_workspace=is_workspace\n    )\n\n\n@router.command(\n    model=\"CongressAmendmentInfo\",\n    examples=[\n        APIEx(\n            parameters={\n                \"provider\": \"congress_gov\",\n                \"amendment_url\": \"119/hamdt/2\",\n            }\n        ),","sourceCodeStart":341,"sourceCodeEnd":377,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/router/congress_gov_router.py#L341-L377","documentation":"HTTPException(500) from the congress.gov router when the amendment-text-choices endpoint is called without amendment_url and not in workspace mode. Same shape as the bill variant: workspace callers get a placeholder list, direct API callers get a 500 with guidance to use the shorthand form like '119/hamdt/2'.","triggerScenarios":"GET amendment_text_choices with no amendment_url; empty-string submissions from a broken form; automated clients that assume the param is optional.","commonSituations":"Integrations built against the REST API rather than the Python interface; missed required params in generated clients; cleared input fields.","solutions":["Supply amendment_url in 'congress/amendment-type/number' form (e.g. '119/hamdt/2') or a full v3 URL.","Validate non-empty input on the client before calling.","Pass is_workspace=true if you want the placeholder response for empty input."],"exampleFix":"# before\nobb.congress.gov_router.amendment_text_choices(amendment_url='')\n\n# after\nobb.congress.gov_router.amendment_text_choices(amendment_url='119/hamdt/2')","handlingStrategy":"validation","validationCode":"if not amendment_url or not amendment_url.strip():\n    raise ValueError('amendment_url is required, e.g. \"119/hamdt/2\"')","typeGuard":"import re\n\ndef is_amendment_shorthand(v: str) -> bool:\n    return bool(re.fullmatch(r'\\d{2,3}/(hamdt|samdt)/\\d+', v))","tryCatchPattern":"from fastapi import HTTPException\n\ntry:\n    choices = await get_amendment_text_choices(amendment_url=amendment_url)\nexcept HTTPException as e:\n    if e.status_code == 500 and 'Amendment URL is required' in e.detail:\n        return render_empty_state()\n    raise","preventionTips":["Make amendment_url mandatory in client forms and generated SDKs.","Use the 'congress/amendment-type/number' shorthand consistently.","Remember this returns HTTP 500, not 400 — match on the detail text when handling it."],"tags":["congress-gov","router","http-exception","required-param","openbb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}