{"record":{"id":"67d8b16a29d98715","repo":"OpenBB-finance/OpenBB","slug":"all-is-not-a-supported-choice-for-category-pl","errorCode":null,"errorMessage":"'all' is not a supported choice for {category}. Please choose from: {list(tables)}","messagePattern":"'all' is not a supported choice for (.+?)\\. Please choose from: (.+?)","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/eia/openbb_us_eia/models/petroleum_status_report.py","lineNumber":91,"sourceCode":"    require_credentials = False\n\n    @staticmethod\n    def transform_query(params: dict[str, Any]) -> EiaPetroleumStatusReportQueryParams:\n        \"\"\"Transform the query parameters.\"\"\"\n        # pylint: disable=import-outside-toplevel\n        from warnings import warn\n\n        category = params.get(\"category\", \"balance_sheet\")\n        tables = WpsrTableMap.get(category, {})\n        _table = params.get(\"table\", \"\")\n\n        if not _table:\n            _table = \"stocks\" if category == \"weekly_estimates\" else \"all\"\n\n        _tables = _table.split(\",\")\n\n        if len(_tables) == 1 and _tables[0] == \"all\" and category == \"weekly_estimates\":\n            raise OpenBBError(\n                ValueError(\n                    f\"'all' is not a supported choice for {category}. Please choose from: {list(tables)}\"\n                )\n            )\n\n        if \"all\" in _tables and len(_tables) > 1:\n            _tables.remove(\"all\")\n            warn(\"'all' cannot be used with other table choices. Ignoring 'all'.\")\n\n        for table in _tables:\n            if table != \"all\" and table not in tables:\n                raise OpenBBError(\n                    ValueError(\n                        f\"Invalid table choice: {table}. Valid choices for {category}: {list(tables)}\"\n                    )\n                )\n\n        params[\"table\"] = \",\".join(_tables)","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/eia/openbb_us_eia/models/petroleum_status_report.py#L73-L109","documentation":"Raised by the EIA Weekly Petroleum Status Report fetcher's query-param validator when table='all' is requested for category='weekly_estimates'. The 'all' expansion only makes sense for the table-based categories; for weekly_estimates you must pick specific tables (e.g. 'stocks'), and the error lists the valid ones from WpsrTableMap.","triggerScenarios":"Calling the WPSR endpoint with category='weekly_estimates' and table omitted (which defaults to 'all' only for other categories) or table='all' explicitly.","commonSituations":"Copy-pasting a table='all' parameter across categories; assuming 'all' is a universal wildcard; upgrading code where weekly_estimates previously tolerated 'all'.","solutions":["Set an explicit table for weekly_estimates, e.g. table='stocks' (the intended default).","Pick from the list printed in the error message / WpsrTableMap['weekly_estimates'] keys.","Condition your request builder: use 'all' only for categories other than weekly_estimates."],"exampleFix":"# before\nparams = {'category': 'weekly_estimates', 'table': 'all'}\n\n# after\nparams = {'category': 'weekly_estimates', 'table': 'stocks'}","handlingStrategy":"validation","validationCode":"def wpsr_table_param(category: str, table: str | None) -> str:\n    if category == 'weekly_estimates':\n        return table or 'stocks'  # 'all' forbidden here\n    return table or 'all'","typeGuard":null,"tryCatchPattern":"try:\n    res = await obb.energy.petroleum_status_report(category=cat, table=tbl, provider='eia')\nexcept OpenBBError as e:\n    if \"'all' is not a supported choice\" in str(e):\n        tbl = 'stocks'\n        res = await obb.energy.petroleum_status_report(category=cat, table=tbl, provider='eia')\n    else:\n        raise","preventionTips":["Never default table to 'all' for weekly_estimates","Build table choices per category from WpsrTableMap"],"tags":["eia","petroleum-status-report","validation","parameter-choices"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}