HKUDS/Vibe-Trading · error · PanelIngestError

{path}: layout={layout!r} needs metric=... -- a wide table h

Error message

{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

What it means

load_panel refuses wide layouts without an explicit metric= argument because a wide table's cells share their row's and column's identity — there is no column to carry a metric label, so the library cannot invent one.

Source

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

        rows: Row dicts as read by ``_read_rows``.
        layout: ``"wide_dates_rows"`` or ``"wide_entities_rows"``.
        metric: The single metric label every cell in this file represents.
        currency: The currency for every value in this file.
        unit: The unit for every value in this file.
        date_format: ``strptime`` format for date cells/headers.
        decimal_separator: Declared decimal separator, or ``None`` to infer.

    Returns:
        An ``EntityPanel``.

    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)}"

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Pass metric='revenue' (or whatever the table measures) to load_panel
  2. Or export/reshape the data to long layout with a metric column and keep layout='long'

Example fix

# before
panel = load_panel('wide.csv')  # wide layout inferred
# after
panel = load_panel('wide.csv', metric='revenue')
Defensive patterns

Strategy: validation

Validate before calling

if inferred_or_given_layout != 'long' and metric is None:
    raise SystemExit('wide layouts require metric=')

Try / catch

except PanelIngestError as e:
    if 'needs metric=' in str(e): retry with metric='revenue'

Prevention

When it happens

Trigger: Calling load_panel with a wide file (or layout='wide_dates_rows'/'wide_entities_rows') without passing metric='...'.

Common situations: Switching a pipeline from long-format exports to wide-format spreadsheets and reusing the old load_panel call.

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/713e8f39b3b37cff. Report an issue: GitHub.