OpenBB-finance/OpenBB · error · HTTPException

Committee system code is required.

Error message

Committee system code is required.

What it means

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.

Source

Thrown at openbb_platform/providers/congress_gov/openbb_congress_gov/router/congress_gov_router.py:675

    import datetime
    import re as _re

    from openbb_congress_gov.utils.committees import fetch_committee_documents
    from openbb_congress_gov.utils.helpers import (
        check_api_key,
        year_to_congress,
    )

    if not committee and is_workspace is True:
        return [
            {
                "label": "Select a committee to view available documents.",
                "value": "",
            }
        ]

    if not committee:
        raise HTTPException(
            status_code=500,
            detail="Committee system code is required.",
        )

    api_key = check_api_key()
    system_code = (subcommittee or committee).lower()

    if congress is None:
        congress = year_to_congress(datetime.date.today().year)

    items = await fetch_committee_documents(
        chamber=chamber.lower(),
        system_code=system_code,
        congress=congress,
        doc_type=doc_type,
        api_key=api_key,
        use_cache=use_cache,
    )

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Pass a valid committee system code, e.g. committee='hsju00' (House Judiciary) with chamber='house'
  2. If building a Workspace-style widget flow, pass is_workspace=True so the empty state returns the placeholder list instead of raising
  3. Get valid system codes from the committee choices endpoint (committee_choices) before calling

Example fix

# before
await obb.congress_gov.committee_document_urls(chamber='house', committee='')

# after
await obb.congress_gov.committee_document_urls(chamber='house', committee='hsju00')
Defensive patterns

Strategy: validation

Validate before calling

from openbb_congress_gov.utils.constants import CommitteeSystemCode  # if exposed; else:
VALID_COMMITTEE_CODES = {'hsju00', 'ssju00', 'hsba00'}  # from committee_choices endpoint

def can_query_documents(committee: str | None, is_workspace: bool) -> bool:
    return bool(committee) or is_workspace is True

Type guard

def is_valid_committee_request(params: dict) -> bool:
    return bool(params.get('committee')) or params.get('is_workspace') is True

Try / catch

from fastapi import HTTPException
try:
    docs = await committee_document_urls(chamber='house', committee=committee)
except HTTPException as e:
    if e.status_code == 500 and 'Committee system code' in e.detail:
        docs = []  # no committee selected
    else:
        raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/434ac7fe79b2b4b8. Report an issue: GitHub.