{"record":{"id":"0ffefa0c3de948fd","repo":"OpenBB-finance/OpenBB","slug":"report-id-report-id-not-found-use-list-reports","errorCode":null,"errorMessage":"Report ID {report_id} not found. Use list_reports() to see available reports.","messagePattern":"Report ID (.+?) not found\\. Use list_reports\\(\\) to see available reports\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/government_us/openbb_government_us/utils/psd_data_downloader.py","lineNumber":66,"sourceCode":"            template_id = report[\"templateId\"]\n\n            # Create a clean filename from the title\n            filename = (\n                title.replace(\" \", \"_\")\n                .replace(\":\", \"\")\n                .replace(\",\", \"\")\n                .replace(\"/\", \"_\")\n            )\n\n            return (\n                f\"{REPORT_HANDLER_URL}?\"\n                f\"reportId={report_id}&\"\n                f\"templateId={template_id}&\"\n                f\"format={file_format}&\"\n                f\"fileName={filename}\"\n            )\n\n    raise ValueError(\n        f\"Report ID {report_id} not found. Use list_reports() to see available reports.\"\n    )\n\n\nasync def get_psd_report_data(report_id: int) -> dict:\n    \"\"\"\n    Download and parse a PSD report into structured data ready for pandas DataFrame.\n\n    Parameters\n    ----------\n    report_id : int\n        The report ID from list_reports()\n\n    Returns\n    -------\n    dict\n        Parsed report with flat structure for DataFrame compatibility:\n        {","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/government_us/openbb_government_us/utils/psd_data_downloader.py#L48-L84","documentation":"Plain ValueError raised at the bottom of get_report_url(report_id, ...) in psd_data_downloader when the given report_id does not match any report in the static PSD_REPORTS_METADATA mapping. The function iterates all groups/templates looking for the id to build a REPORT_HANDLER_URL; falling through means the id is unknown to this library version.","triggerScenarios":"Passing a report id that is not in PSD_REPORTS_METADATA: typos, ids from a newer/older USDA FAS PSD Online release, or ids invented from the website UI.","commonSituations":"Library metadata out of sync with the live PSD Online site after USDA adds/removes reports; users copying numeric ids from the web UI without confirming via list_reports().","solutions":["Call list_reports() first and use an id it returns.","Update openbb-platform so PSD_REPORTS_METADATA matches the current USDA catalog.","If the report should exist, open an issue so the metadata mapping gets updated."],"exampleFix":"# before\nget_report_url(999999, \"csv\")\n\n# after\nfrom openbb_government_us.utils.psd_data_downloader import list_reports\nreports = list_reports()  # pick a valid id\nget_report_url(valid_id, \"csv\")","handlingStrategy":"validation","validationCode":"from openbb_government_us.utils.psd_data_downloader import PSD_REPORTS_METADATA\n\ndef valid_report_id(report_id: int) -> bool:\n    return any(report_id in g[\"reports\"] for g in PSD_REPORTS_METADATA.values())","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always enumerate reports with list_reports() and present those ids to users.","Re-validate stored ids after upgrading the provider (metadata changes between versions)."],"tags":["validation","psd","metadata","usda"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}