{"record":{"id":"434ac7fe79b2b4b8","repo":"OpenBB-finance/OpenBB","slug":"committee-system-code-is-required","errorCode":null,"errorMessage":"Committee system code is required.","messagePattern":"Committee system code is required\\.","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"openbb_platform/providers/congress_gov/openbb_congress_gov/router/congress_gov_router.py","lineNumber":675,"sourceCode":"    import datetime\n    import re as _re\n\n    from openbb_congress_gov.utils.committees import fetch_committee_documents\n    from openbb_congress_gov.utils.helpers import (\n        check_api_key,\n        year_to_congress,\n    )\n\n    if not committee and is_workspace is True:\n        return [\n            {\n                \"label\": \"Select a committee to view available documents.\",\n                \"value\": \"\",\n            }\n        ]\n\n    if not committee:\n        raise HTTPException(\n            status_code=500,\n            detail=\"Committee system code is required.\",\n        )\n\n    api_key = check_api_key()\n    system_code = (subcommittee or committee).lower()\n\n    if congress is None:\n        congress = year_to_congress(datetime.date.today().year)\n\n    items = await fetch_committee_documents(\n        chamber=chamber.lower(),\n        system_code=system_code,\n        congress=congress,\n        doc_type=doc_type,\n        api_key=api_key,\n        use_cache=use_cache,\n    )","sourceCodeStart":657,"sourceCodeEnd":693,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/congress_gov/openbb_congress_gov/router/congress_gov_router.py#L657-L693","documentation":"Raised as an HTTPException (500) by the congress_gov router's committee_document_urls endpoint when the committee parameter is empty and the request is not flagged as coming from OpenBB Workspace (is_workspace=False). The endpoint requires a committee system code (e.g. 'hsju00') to build the committee documents URL; without one there is nothing to query. The Workspace branch instead gets a placeholder dropdown entry, so only direct API calls hit the raise.","triggerScenarios":"Calling the /congress_gov/committee_document_urls route (or Python function) with committee='' or None and is_workspace=False (default). Workspace calls omit committee on first render and send is_workspace=True, so they take the placeholder branch instead.","commonSituations":"Scripts or dashboards that copy the Workspace widget's parameter list but forget the is_workspace flag; passing a committee name like 'Judiciary' instead of the system code 'hsju00'; front-end forms submitting before the committee selector is populated.","solutions":["Pass a valid committee system code, e.g. committee='hsju00' (House Judiciary) with chamber='house'","If building a Workspace-style widget flow, pass is_workspace=True so the empty state returns the placeholder list instead of raising","Get valid system codes from the committee choices endpoint (committee_choices) before calling"],"exampleFix":"# before\nawait obb.congress_gov.committee_document_urls(chamber='house', committee='')\n\n# after\nawait obb.congress_gov.committee_document_urls(chamber='house', committee='hsju00')","handlingStrategy":"validation","validationCode":"from openbb_congress_gov.utils.constants import CommitteeSystemCode  # if exposed; else:\nVALID_COMMITTEE_CODES = {'hsju00', 'ssju00', 'hsba00'}  # from committee_choices endpoint\n\ndef can_query_documents(committee: str | None, is_workspace: bool) -> bool:\n    return bool(committee) or is_workspace is True","typeGuard":"def is_valid_committee_request(params: dict) -> bool:\n    return bool(params.get('committee')) or params.get('is_workspace') is True","tryCatchPattern":"from fastapi import HTTPException\ntry:\n    docs = await committee_document_urls(chamber='house', committee=committee)\nexcept HTTPException as e:\n    if e.status_code == 500 and 'Committee system code' in e.detail:\n        docs = []  # no committee selected\n    else:\n        raise","preventionTips":["Populate committee from the committee_choices endpoint rather than free text","Guard front-end forms so the request fires only after a committee is selected","Pass is_workspace=True when replicating the Workspace widget flow"],"tags":["congress-gov","validation","required-parameter","http-exception"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}