HKUDS/Vibe-Trading · error · PanelIngestError

{path}: layout={layout!r} needs unit=... -- a wide table has

Error message

{path}: layout={layout!r} needs unit=... -- a wide table has no unit column, and unit is never defaulted

What it means

Wide layouts have no unit column, and unit is never defaulted, so load_panel requires an explicit unit= argument for wide tables.

Source

Thrown at agent/src/entities/ingest.py:1103

    Raises:
        PanelIngestError: If ``metric``/``currency``/``unit`` is missing, the
            file has fewer than two columns, a column header in
            ``wide_entities_rows`` is not a usable date, or a cell fails to
            parse.
    """
    if metric is None:
        raise PanelIngestError(
            f"{path}: layout={layout!r} needs metric=... -- a wide table has "
            "nowhere to put a metric label; every cell already shares its "
            "row's and column's identity"
        )
    if currency is None:
        raise PanelIngestError(
            f"{path}: layout={layout!r} needs currency=... -- a wide table "
            "has no currency column, and currency is never defaulted"
        )
    if unit is None:
        raise PanelIngestError(
            f"{path}: layout={layout!r} needs unit=... -- a wide table has "
            "no unit column, and unit is never defaulted"
        )
    if len(header) < 2:
        raise PanelIngestError(
            f"{path}: layout={layout!r} needs at least one column besides "
            f"the first (row-label) column. Columns present: {', '.join(header)}"
        )

    row_label_column = header[0]
    series_columns = list(header[1:])

    column_dates: dict[str, date] = {}
    if layout == "wide_entities_rows":
        for column_name in series_columns:
            try:
                column_dates[column_name] = _parse_panel_date(
                    column_name, date_format, path, row_number=0

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Pass unit='millions' (etc.) to load_panel
  2. Or reshape to long layout with a unit column

Example fix

# before
panel = load_panel('wide.csv', metric='revenue', currency='USD')
# after
panel = load_panel('wide.csv', metric='revenue', currency='USD', unit='millions')
Defensive patterns

Strategy: validation

Validate before calling

if layout_is_wide and unit is None: unit = 'millions'  # set explicitly

Try / catch

except PanelIngestError as e:
    if 'needs unit=' in str(e): retry with explicit unit

Prevention

When it happens

Trigger: Calling load_panel on a wide table (or with layout='wide_*') without unit='...'.

Common situations: Wide tables where units live in a footnote or header text rather than a column.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/7b61d082e5bf2bc1. Report an issue: GitHub.