HKUDS/Vibe-Trading · error · ValueError

flows may contain at most {_MAX_INLINE_FLOWS} entries

Error message

flows may contain at most {_MAX_INLINE_FLOWS} entries

What it means

The inline flows array exceeds _MAX_INLINE_FLOWS entries. The cap exists to bound tool-call payload size and compute time; large datasets must go through flows_path (CSV file) instead.

Source

Thrown at agent/src/tools/cashflow_analytics_tool.py:375

    if path:
        columns = kwargs.get("flows_columns")
        if columns is not None and not isinstance(columns, dict):
            raise ValueError("flows_columns must be an object mapping field to column name")
        return load_cashflows(
            str(path),
            columns=columns,
            currency=currency,
            default_kind=kwargs.get("flows_default_kind"),
            date_format=kwargs.get("flows_date_format"),
            invert_sign=bool(kwargs.get("flows_invert_sign", False)),
        )

    if not inline:
        return None
    if not isinstance(inline, list):
        raise ValueError("flows must be an array of {date, amount, kind} objects")
    if len(inline) > _MAX_INLINE_FLOWS:
        raise ValueError(f"flows may contain at most {_MAX_INLINE_FLOWS} entries")

    records: list[CashFlow] = []
    for index, item in enumerate(inline):
        if not isinstance(item, dict):
            raise ValueError(f"flows[{index}] must be an object")
        row_currency = item.get("currency") or currency
        if not row_currency:
            raise ValueError(
                f"flows[{index}] has no currency and no top-level currency was "
                "given; currency is never defaulted"
            )
        try:
            records.append(
                CashFlow(
                    date=item["date"],
                    amount=item["amount"],
                    kind=item["kind"],
                    currency=row_currency,

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Write the flows to a CSV and pass flows_path instead of (or here, in place of) the inline list
  2. Batch or downsample the data if only aggregates are needed
  3. Check the _MAX_INLINE_FLOWS constant in the module for the exact limit

Example fix

# before
execute(flows=records)  # too many
# after
import csv
with open("cf.csv", "w", newline="") as f:
    w = csv.DictWriter(f, fieldnames=["date", "amount", "kind"])
    w.writeheader(); w.writerows(records)
execute(flows_path="cf.csv")
Defensive patterns

Strategy: validation

Validate before calling

from agent.src.tools.cashflow_analytics_tool import _MAX_INLINE_FLOWS
if len(flows) > _MAX_INLINE_FLOWS:
    # export to CSV and use flows_path instead
    ...

Prevention

When it happens

Trigger: execute(flows=[...5000 records...]) where len(inline) > _MAX_INLINE_FLOWS.

Common situations: Trying to pass a full transaction history inline; agents stuffing exported ledgers into the tool call; migrating a batch job onto the tool without offloading to a file.

Related errors


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