{"record":{"id":"4f73412c8296a7cb","repo":"HKUDS/Vibe-Trading","slug":"symbol-is-required-4f7341","errorCode":null,"errorMessage":"symbol is required","messagePattern":"symbol is required","errorType":"validation","errorClass":"EtoroAPIError","httpStatus":null,"severity":"error","filePath":"agent/src/trading/connectors/etoro/trading.py","lineNumber":285,"sourceCode":"        body[\"clearStopLoss\"] = True\n    if clear_take_profit:\n        body[\"clearTakeProfit\"] = True\n\n    req_id = (request_id or str(uuid.uuid4())).strip()\n    path = f\"{positions_root(cfg)}/positions/{pos_id}\"\n    try:\n        payload = make_client(cfg).request(\"PATCH\", path, json_body=body, request_id=req_id)\n    except EtoroAPIError as exc:\n        return _order_error(cfg, str(exc), position_id=pos_id, request_id=req_id)\n\n    return {\"status\": \"ok\", **_base(cfg), \"position_id\": pos_id, \"request_id\": req_id, \"raw\": payload}\n\n\ndef _order_instrument_ref(symbol: str, cfg: EtoroConfig) -> dict[str, Any]:\n    \"\"\"Build exactly one of ``symbol`` or ``instrumentId`` for open-order bodies.\"\"\"\n    token = str(symbol or \"\").strip()\n    if not token:\n        raise EtoroAPIError(\"symbol is required\")\n    if _looks_like_ticker(token):\n        return {\"symbol\": token}\n    instrument_id = resolve_instrument_id(token, cfg)\n    return {\"instrumentId\": instrument_id}\n\n\ndef _extract_order_id(payload: Any) -> str | None:\n    if not isinstance(payload, dict):\n        return None\n    for key in (\"orderID\", \"orderId\", \"order_id\", \"id\"):\n        value = payload.get(key)\n        if value is not None:\n            return str(value)\n    data = payload.get(\"data\")\n    if isinstance(data, dict):\n        for key in (\"orderID\", \"orderId\", \"order_id\", \"id\"):\n            value = data.get(key)\n            if value is not None:","sourceCodeStart":267,"sourceCodeEnd":303,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/etoro/trading.py#L267-L303","documentation":"Raised by _order_instrument_ref (used by place_order) when the symbol argument strips to empty. The order body needs either a ticker symbol or an instrumentId.","triggerScenarios":"place_order(symbol='', ...) or symbol=None; order built from a blank form field or missing config.","commonSituations":"UI allowing empty ticker, position-close loop with a None symbol, template rendering an empty string.","solutions":["Validate symbol is non-empty before building the order","Fix upstream data source producing blank symbols"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if not (symbol or '').strip():\n    raise ValueError('cannot place order without a symbol')","typeGuard":"def order_has_symbol(sym: str | None) -> bool:\n    return bool(sym and sym.strip())","tryCatchPattern":null,"preventionTips":["Validate order forms server-side before submission","Never build orders from unvalidated user input"],"tags":["etoro","order","symbol","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}