HKUDS/Vibe-Trading · error · ValueError

__series__ needs a 'values' list

Error message

__series__ needs a 'values' list

What it means

Raised by quantlib_tool._decode when a value carries the __series__ marker but its payload is not a dict containing a 'values' key. _decode is a recursive JSON-to-pandas deserializer: {'__series__': {'values': [...], 'index': [...]}} becomes a pd.Series, and a malformed spec (values missing, misspelled, or the spec not a dict at all) aborts decoding.

Source

Thrown at agent/src/tools/quantlib_tool.py:153

    """Turn JSON envelopes into the pandas objects some functions require.

    Args:
        value: A decoded-JSON value, possibly a ``__series__`` or
            ``__dataframe__`` envelope, possibly nested inside a container.

    Returns:
        The value with any envelope replaced by the pandas object it describes.

    Raises:
        ValueError: If an envelope is malformed.
    """
    import pandas as pd

    if isinstance(value, dict):
        if "__series__" in value:
            spec = value["__series__"]
            if not isinstance(spec, dict) or "values" not in spec:
                raise ValueError("__series__ needs a 'values' list")
            return pd.Series(spec["values"], index=spec.get("index"))
        if "__dataframe__" in value:
            spec = value["__dataframe__"]
            if not isinstance(spec, dict) or "data" not in spec:
                raise ValueError("__dataframe__ needs a 'data' list of rows")
            return pd.DataFrame(
                spec["data"], index=spec.get("index"), columns=spec.get("columns")
            )
        return {k: _decode(v) for k, v in value.items()}
    if isinstance(value, list):
        return [_decode(v) for v in value]
    return value


class _Budget:
    """Mutable leaf counter shared across one serialization pass."""

    def __init__(self) -> None:

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Ensure the __series__ spec is a dict with a required 'values' list: {'__series__': {'values': [...], 'index': [...]}}
  2. Check for typos like 'value' or 'data' instead of 'values'
  3. Pass plain JSON lists and let the tool build the Series if the encoding isn't needed
  4. Upgrade/align caller and tool versions if the envelope format changed

Example fix

# before
{"__series__": {"vals": [1, 2, 3]}}

# after
{"__series__": {"values": [1, 2, 3], "index": ["a", "b", "c"]}}
Defensive patterns

Strategy: type-guard

Type guard

def is_valid_series_envelope(v: object) -> bool:
    return (
        isinstance(v, dict)
        and set(v) == {"__series__"}
        and isinstance(v["__series__"], dict)
        and isinstance(v["__series__"].get("values"), list)
    )

Try / catch

try:
    decoded = _decode(payload)
except ValueError as e:
    if "__series__" in str(e):
        payload["__series__"] = {"values": payload["__series__"]}  # repair common mistake and retry

Prevention

When it happens

Trigger: Passing {'__series__': [1,2,3]} (spec is a list, not a dict); {'__series__': {'vals': [...]}} (key misspelled); {'__series__': null}; or nesting a __series__ marker with an empty dict spec inside tool arguments that get recursively decoded.

Common situations: LLM/hand-written tool arguments attempting the __series__ encoding and getting the schema wrong; serialization bugs in a caller that constructs these envelopes programmatically; version drift after the encoding format changed.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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