{"record":{"id":"c8013d1c75e5cc4e","repo":"OpenBB-finance/OpenBB","slug":"no-text-available-for-this-amendment-currently","errorCode":null,"errorMessage":"No text available for this amendment currently.","messagePattern":"No text available for this amendment currently\\.","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/utils/helpers.py","lineNumber":841,"sourceCode":"    # Step 4: If no text versions found, fall back to the amended bill's text versions.\n    bill_text_versions: list = []\n\n    if not text_versions and not committee_report_text:\n        amended_bill = amendment_detail.get(\"amendedBill\", {})\n        bill_url = amended_bill.get(\"url\", \"\") if amended_bill else \"\"\n\n        if bill_url:\n            bill_text_url = bill_url.replace(\"?\", \"/text?\") + f\"&api_key={api_key}\"\n\n            try:\n                bill_tv_response: dict = await amake_request(bill_text_url)  # type: ignore\n                bill_text_versions = bill_tv_response.get(\"textVersions\", [])\n            except Exception:  # pylint: disable=broad-except  # noqa: S110\n                pass\n\n    if is_workspace is False:\n        if not text_versions and not committee_report_text and not bill_text_versions:\n            raise HTTPException(\n                status_code=404,\n                detail=\"No text available for this amendment currently.\",\n            )\n\n        text_output: list = []\n        seen_pdf_urls: set = set()\n\n        def _deduped_entry(entry: dict, formats: list) -> dict | None:\n            pdf_url = next(\n                (f.get(\"url\") for f in formats if f.get(\"type\") == \"PDF\"), None\n            )\n\n            if pdf_url and pdf_url in seen_pdf_urls:\n                return None\n\n            if pdf_url:\n                seen_pdf_urls.add(pdf_url)\n","sourceCodeStart":823,"sourceCodeEnd":859,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/utils/helpers.py#L823-L859","documentation":"get_amendment_text gathers text from up to three sources — the amendment's own textVersions, an associated committee report, and the parent bill's textVersions (fetched only when bill_url is given, with its exceptions swallowed). If all are empty and is_workspace=False, HTTPException(404) is raised. Like the bill-text twin, this mostly means GPO has not published text for the amendment yet.","triggerScenarios":"A recently offered amendment whose text is not yet on GPO; amendments that only exist as committee-report text with report_url absent; bill_url not passed, so the parent-bill fallback never runs.","commonSituations":"Dashboards deep-linking from amendment lists to text; amendment records whose text lives only in the linked bill but the bill_url field was dropped upstream.","solutions":["Catch 404 and surface 'text not yet published' as a normal state","Pass bill_url when you have it, so the parent-bill fallback can find text","Retry after 24-48h for newly offered amendments"],"exampleFix":"# before\ntext = await get_amendment_text(amendment_url=u, is_workspace=False)\n\n# after\ntry:\n    text = await get_amendment_text(amendment_url=u, bill_url=parent_bill, is_workspace=False)\nexcept HTTPException as e:\n    if e.status_code == 404:\n        text = []  # no text published yet\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":"def amendment_text_inputs_ready(amendment_url: str, bill_url: str | None) -> bool:\n    return bool(amendment_url)  # pass bill_url too to enable the fallback source","typeGuard":null,"tryCatchPattern":"from fastapi import HTTPException\n\nasync def safe_amendment_text(amendment_url: str, bill_url: str | None = None) -> list:\n    try:\n        return await get_amendment_text(amendment_url=amendment_url, bill_url=bill_url, is_workspace=False)\n    except HTTPException as e:\n        if e.status_code == 404:\n            return []  # no text published yet\n        raise","preventionTips":["Always pass bill_url when available — it is the fallback text source","Treat 404 as a normal 'not yet published' state for fresh amendments","Retry next day for recently offered amendments"],"tags":["congress-gov","not-found","amendment-text","http-exception"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}