{"record":{"id":"a96911e096cebff8","repo":"HKUDS/Vibe-Trading","slug":"series-needs-a-values-list","errorCode":null,"errorMessage":"__series__ needs a 'values' list","messagePattern":"__series__ needs a 'values' list","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/tools/quantlib_tool.py","lineNumber":153,"sourceCode":"    \"\"\"Turn JSON envelopes into the pandas objects some functions require.\n\n    Args:\n        value: A decoded-JSON value, possibly a ``__series__`` or\n            ``__dataframe__`` envelope, possibly nested inside a container.\n\n    Returns:\n        The value with any envelope replaced by the pandas object it describes.\n\n    Raises:\n        ValueError: If an envelope is malformed.\n    \"\"\"\n    import pandas as pd\n\n    if isinstance(value, dict):\n        if \"__series__\" in value:\n            spec = value[\"__series__\"]\n            if not isinstance(spec, dict) or \"values\" not in spec:\n                raise ValueError(\"__series__ needs a 'values' list\")\n            return pd.Series(spec[\"values\"], index=spec.get(\"index\"))\n        if \"__dataframe__\" in value:\n            spec = value[\"__dataframe__\"]\n            if not isinstance(spec, dict) or \"data\" not in spec:\n                raise ValueError(\"__dataframe__ needs a 'data' list of rows\")\n            return pd.DataFrame(\n                spec[\"data\"], index=spec.get(\"index\"), columns=spec.get(\"columns\")\n            )\n        return {k: _decode(v) for k, v in value.items()}\n    if isinstance(value, list):\n        return [_decode(v) for v in value]\n    return value\n\n\nclass _Budget:\n    \"\"\"Mutable leaf counter shared across one serialization pass.\"\"\"\n\n    def __init__(self) -> None:","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/tools/quantlib_tool.py#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Ensure the __series__ spec is a dict with a required 'values' list: {'__series__': {'values': [...], 'index': [...]}}","Check for typos like 'value' or 'data' instead of 'values'","Pass plain JSON lists and let the tool build the Series if the encoding isn't needed","Upgrade/align caller and tool versions if the envelope format changed"],"exampleFix":"# before\n{\"__series__\": {\"vals\": [1, 2, 3]}}\n\n# after\n{\"__series__\": {\"values\": [1, 2, 3], \"index\": [\"a\", \"b\", \"c\"]}}","handlingStrategy":"type-guard","validationCode":null,"typeGuard":"def is_valid_series_envelope(v: object) -> bool:\n    return (\n        isinstance(v, dict)\n        and set(v) == {\"__series__\"}\n        and isinstance(v[\"__series__\"], dict)\n        and isinstance(v[\"__series__\"].get(\"values\"), list)\n    )","tryCatchPattern":"try:\n    decoded = _decode(payload)\nexcept ValueError as e:\n    if \"__series__\" in str(e):\n        payload[\"__series__\"] = {\"values\": payload[\"__series__\"]}  # repair common mistake and retry","preventionTips":["Use a single helper to build __series__/__dataframe__ envelopes rather than hand-writing them","Validate the envelope against the expected schema before sending tool args","Prefer plain JSON lists when pandas indexing isn't required"],"tags":["quantlib","serialization","pandas","validation"],"backgroundTag":"schema-validation-failed","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}