{"record":{"id":"c87e9332858599c3","repo":"HKUDS/Vibe-Trading","slug":"symbol-is-required","errorCode":null,"errorMessage":"symbol is required","messagePattern":"symbol is required","errorType":"validation","errorClass":"EtoroAPIError","httpStatus":null,"severity":"warning","filePath":"agent/src/trading/connectors/etoro/instruments.py","lineNumber":299,"sourceCode":"    instruments = normalized[:clean_limit]\n    if include_rates:\n        _attach_rates(cfg, instruments)\n\n    return {\n        \"status\": \"ok\",\n        **_base_payload(cfg),\n        \"instrument_type_id\": type_id,\n        \"instrument_type\": id_to_label[type_id],\n        \"mode\": \"type\",\n        \"instruments\": instruments,\n    }\n\n\ndef resolve_instrument_id(symbol: str, cfg: EtoroConfig) -> int:\n    \"\"\"Resolve a user symbol to an eToro ``instrumentId`` for trading APIs.\"\"\"\n    token = str(symbol or \"\").strip()\n    if not token:\n        raise EtoroAPIError(\"symbol is required\")\n    if token.isdigit():\n        instrument_id = int(token)\n        if instrument_id in _INVALID_INSTRUMENT_IDS or instrument_id < 0:\n            raise EtoroAPIError(f\"invalid instrument id {instrument_id}\")\n        return instrument_id\n\n    canonical = _canonical_ticker(token)\n    candidates: list[tuple[int, int]] = []  # (priority, instrument_id)\n\n    for lookup in _lookup_variants(token, canonical):\n        for item in _search_by_symbol(cfg, lookup, limit=25):\n            instrument_id = _instrument_id(item)\n            if instrument_id is None:\n                continue\n            priority = _match_priority(item, lookup, canonical, token)\n            if priority > 0:\n                candidates.append((priority, instrument_id))\n","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/etoro/instruments.py#L281-L317","documentation":"Raised by resolve_instrument_id when the symbol argument strips to an empty string. Symbol resolution requires a ticker or numeric instrument id.","triggerScenarios":"resolve_instrument_id('') or resolve_instrument_id(None); downstream via get_quote('') or get_historical_bars('') or place_order with empty symbol.","commonSituations":"Empty form field, missing config value, or a loop iterating over a list containing ''.","solutions":["Check symbol is non-empty before calling","Fix the upstream data producing empty symbols"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if not (symbol or '').strip():\n    raise ValueError('symbol required')","typeGuard":"def has_symbol(sym: str | None) -> bool:\n    return bool(sym and sym.strip())","tryCatchPattern":null,"preventionTips":["Validate symbol inputs at the UI/API boundary","Filter empty strings out of symbol lists before batch processing"],"tags":["etoro","symbol","validation"],"backgroundTag":"missing-required-parameter","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}