{"record":{"id":"0055c01fef16799f","repo":"OpenBB-finance/OpenBB","slug":"no-text-available-for-this-bill-currently","errorCode":null,"errorMessage":"No text available for this bill currently.","messagePattern":"No text available for this bill currently\\.","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"warning","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/utils/helpers.py","lineNumber":438,"sourceCode":"\n    Returns\n    -------\n    list[dict]\n        List of dictionaries with the results.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    from openbb_core.provider.utils.helpers import amake_request\n\n    api_key = check_api_key()\n    results: list = []\n    url = bill_url.replace(\"?\", \"/text?\") + f\"&api_key={api_key}\"\n    response = await amake_request(url)\n    bill_text = response.get(\"textVersions\", [])  # type: ignore\n\n    # Return the results for non-Workspace queries\n    if is_workspace is False:\n        if not bill_text:\n            raise HTTPException(\n                status_code=404,\n                detail=\"No text available for this bill currently.\",\n            )\n\n        text_output: list = []\n        seen_urls: set = set()\n\n        for version in bill_text:\n            bill_version: dict = {}\n            formats = version.get(\"formats\", [])\n            bill_type = version.get(\"type\", \"\")\n            version_date = version.get(\"date\", \"\")\n\n            if not formats or not version_date:\n                continue\n\n            pdf_url = next(\n                (f.get(\"url\") for f in formats if f.get(\"type\") == \"PDF\"), None","sourceCodeStart":420,"sourceCodeEnd":456,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/utils/helpers.py#L420-L456","documentation":"get_bill_text fetches the textVersions array for a bill URL; when the response has none and the caller is not the Workspace (is_workspace=False), it raises HTTPException(404). Many bills — brand-new introductions, or bills whose text has not been published by GPO — legitimately have zero text versions, so this is a 'not yet available' signal rather than a broken URL.","triggerScenarios":"Requesting text for a bill introduced minutes/hours ago; a bill URL copied before text publication; private laws or obscure measures GPO never published. Workspace callers get an empty list instead of the exception.","commonSituations":"Dashboards linking straight from a bills list to text without handling the not-yet-published case; racing Congress.gov publication latency (often hours to days after introduction).","solutions":["Treat 404 as expected: catch it and show 'text not yet published' rather than an error","Only surface text links for bills whose API entry already indicates text availability","Retry later if the bill was just introduced — text usually appears within days"],"exampleFix":"# before\nfrom fastapi import HTTPException\ntext = await get_bill_text(bill_url=url, is_workspace=False)\n\n# after\ntry:\n    text = await get_bill_text(bill_url=url, is_workspace=False)\nexcept HTTPException as e:\n    if e.status_code == 404:\n        text = []  # text not yet published\n    else:\n        raise","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"from fastapi import HTTPException\n\nasync def safe_bill_text(bill_url: str) -> list:\n    try:\n        return await get_bill_text(bill_url=bill_url, is_workspace=False)\n    except HTTPException as e:\n        if e.status_code == 404:\n            return []  # text not published yet — normal state\n        raise","preventionTips":["Treat 404 as expected for newly introduced bills","Check the bill's latestAction/text indicator in list responses before offering a text link","Retry after 24-48h for fresh introductions"],"tags":["congress-gov","not-found","bill-text","http-exception"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}