HKUDS/Vibe-Trading · error · PanelIngestError

layout must be one of {_PANEL_LAYOUTS}, got {layout!r}

Error message

layout must be one of {_PANEL_LAYOUTS}, got {layout!r}

What it means

load_panel rejects layout values outside _PANEL_LAYOUTS ('long', 'wide_dates_rows', 'wide_entities_rows') with a PanelIngestError before reading the file.

Source

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

    Returns:
        An ``EntityPanel`` ordered by ``(entity_id, date, metric)``. A
        ``"long"`` file with a header but no data rows yields an empty panel,
        matching ``load_cashflows``.

    Raises:
        PanelIngestError: If the file is missing, unreadable, or has no
            header row; the layout cannot be determined or is invalid; a
            required column or argument is absent; or any cell fails to
            parse.
        ValueError: If ``decimal_separator`` is neither ``"."`` nor ``","``.
    """
    if decimal_separator is not None and decimal_separator not in _DECIMAL_SEPARATORS:
        raise ValueError(
            f"decimal_separator must be one of {_DECIMAL_SEPARATORS}, "
            f"got {decimal_separator!r}"
        )
    if layout is not None and layout not in _PANEL_LAYOUTS:
        raise PanelIngestError(f"layout must be one of {_PANEL_LAYOUTS}, got {layout!r}")

    path = Path(path).expanduser()
    try:
        header, rows = _read_rows(path, delimiter, encoding)
    except CashFlowIngestError as exc:
        raise PanelIngestError(str(exc)) from exc

    resolved_layout = layout or _infer_panel_layout(header, date_format, path)

    if resolved_layout == "long":
        return _load_panel_long(
            path,
            header,
            rows,
            columns=columns,
            entity=entity,
            metric=metric,
            currency=currency,

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Use one of the printed valid values, e.g. layout='wide_dates_rows' (dates as columns) or layout='wide_entities_rows' (entities as columns)
  2. Omit layout to let the library infer it

Example fix

# before
panel = load_panel('p.csv', layout='wide')
# after
panel = load_panel('p.csv', layout='wide_dates_rows')
Defensive patterns

Strategy: validation

Validate before calling

assert layout in (None, 'long', 'wide_dates_rows', 'wide_entities_rows')

Try / catch

except PanelIngestError as e:
    if 'layout must be one of' in str(e): pick a valid layout or omit

Prevention

When it happens

Trigger: Calling load_panel(layout='wide') or layout='rows' or any string not in the allowed set.

Common situations: Assuming 'wide' is a valid value (the API splits it into wide_dates_rows/wide_entities_rows), or typos from config files.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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