{"record":{"id":"0358fb64e311195d","repo":"HKUDS/Vibe-Trading","slug":"name-is-required","errorCode":null,"errorMessage":"{name} is required","messagePattern":"(.+?) is required","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"agent/src/tools/options_payoff_tool.py","lineNumber":261,"sourceCode":"            qty_number = float(raw_qty)\n        except (KeyError, TypeError, ValueError, OverflowError) as exc:\n            raise ValueError(f\"legs[{index}] has invalid strike or qty: {exc}\") from exc\n        if isinstance(raw_qty, bool) or not qty_number.is_integer():\n            raise ValueError(f\"legs[{index}].qty must be a non-zero integer\")\n        qty = int(qty_number)\n        raw_premium = item.get(\"premium\")\n        try:\n            premium = None if raw_premium is None else float(raw_premium)\n        except (TypeError, ValueError, OverflowError) as exc:\n            raise ValueError(f\"legs[{index}].premium must be numeric or null\") from exc\n        legs.append(OptionLeg(option_type, strike, qty, premium))\n    return legs\n\n\ndef _required_float(kwargs: dict[str, Any], name: str) -> float:\n    \"\"\"Read a required finite float.\"\"\"\n    if name not in kwargs or kwargs[name] is None or kwargs[name] == \"\":\n        raise ValueError(f\"{name} is required\")\n    try:\n        value = float(kwargs[name])\n    except (TypeError, ValueError, OverflowError) as exc:\n        raise ValueError(f\"{name} must be numeric\") from exc\n    if not math.isfinite(value):\n        raise ValueError(f\"{name} must be finite\")\n    return value\n\n\ndef _optional_float(kwargs: dict[str, Any], name: str, default: float) -> float:\n    \"\"\"Read an optional finite float, treating null and empty text as omitted.\"\"\"\n    raw = kwargs.get(name)\n    if raw is None or raw == \"\":\n        return default\n    try:\n        value = float(raw)\n    except (TypeError, ValueError, OverflowError) as exc:\n        raise ValueError(f\"{name} must be numeric\") from exc","sourceCodeStart":243,"sourceCodeEnd":279,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/tools/options_payoff_tool.py#L243-L279","documentation":"Thrown by _required_float when a mandatory numeric kwarg (e.g. entry_spot, entry_iv) is absent, null, or empty string. These parameters anchor all payoff/greeks math so the tool refuses to default them.","triggerScenarios":"Calling execute without entry_spot; passing entry_spot=None or \"\"; kwargs keys with different casing (entrySpot) so the expected key is effectively missing.","commonSituations":"LLM tool calls omitting required params; clients forwarding optional-only forms; schema drift between caller and tool versions renaming parameters.","solutions":["Supply the required parameter with a numeric value (check the tool's arg spec for which names _required_float guards)","Fix key names/casing to exactly match the tool schema","If the value is genuinely unknown, have the caller compute/fetch it before invoking"],"exampleFix":"// before\nexecute({\"legs\": legs})  # missing entry_spot\n// after\nexecute({\"legs\": legs, \"entry_spot\": 100.0})","handlingStrategy":"validation","validationCode":"REQUIRED = (\"entry_spot\", \"entry_iv\")  # per tool spec\nmissing = [k for k in REQUIRED if kwargs.get(k) in (None, \"\")]\nif missing:\n    raise ValueError(f\"missing required params: {missing}\")","typeGuard":"def has_required_numeric_kwargs(kwargs: dict, names: tuple) -> bool:\n    return all(kwargs.get(n) not in (None, \"\") for n in names)","tryCatchPattern":"try:\n    execute(kwargs)\nexcept ValueError as e:\n    if \"is required\" in str(e):\n        prompt_user_for(str(e).split()[0])","preventionTips":["Generate calls from the tool's declared schema","Mark required fields as such in LLM function definitions","Prefill required params from context before dispatch"],"tags":["validation","required-field","options"],"backgroundTag":"missing-required-parameter","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}