{"record":{"id":"e083b1c0f38dbe45","repo":"HKUDS/Vibe-Trading","slug":"trading-212-connector-not-configured-missing","errorCode":null,"errorMessage":"Trading 212 connector not configured: missing {', '.join(missing)}.","messagePattern":"Trading 212 connector not configured: missing (.+?)\\.","errorType":"exception","errorClass":"Trading212ConfigError","httpStatus":null,"severity":"error","filePath":"agent/src/trading/connectors/trading212/sdk.py","lineNumber":408,"sourceCode":"    return _order_refused(cfg, _ORDER_DISABLED_ERROR, order_id=order_id, symbol=symbol)\n\n\ndef _get(config: Trading212Config, path: str, *, params: Mapping[str, Any] | None = None) -> Any:\n    \"\"\"Perform a read-only GET request against the Trading 212 REST API.\"\"\"\n    return _request(config, \"GET\", path, params=params)\n\n\ndef _request(\n    config: Trading212Config,\n    method: str,\n    path: str,\n    *,\n    params: Mapping[str, Any] | None = None,\n) -> Any:\n    \"\"\"Run an HTTP request and normalize Trading 212 failure modes.\"\"\"\n    missing = _missing_fields(config)\n    if missing:\n        raise Trading212ConfigError(f\"Trading 212 connector not configured: missing {', '.join(missing)}.\")\n\n    url = urljoin(f\"{config.base_url.rstrip('/')}/\", path.lstrip(\"/\"))\n    headers = {\"Accept\": \"application/json\"}\n    auth = None\n    if config.api_secret:\n        auth = (config.api_key, config.api_secret)\n    else:\n        headers[\"Authorization\"] = config.api_key\n    try:\n        response = requests.request(\n            method.upper(),\n            url,\n            headers=headers,\n            auth=auth,\n            params=dict(params or {}),\n            timeout=config.timeout,\n        )\n    except requests.RequestException as exc:","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/trading212/sdk.py#L390-L426","documentation":"Raised by _request when the supplied Trading212Config is missing required fields (as computed by _missing_fields), meaning the connector has not been fully configured before an API call. Every HTTP helper (_get and everything above it) checks this before touching the network.","triggerScenarios":"Calling any endpoint helper (e.g. get_positions, get_account_snapshot) with a config where required fields such as api_key/base_url are empty — typically when load_config returned the default empty Trading212Config because no config file exists, or save_config was never called.","commonSituations":"Fresh install with no configuration step run; config file deleted or never created; test environment asserting on API calls without setting config; CI running integration code paths without credentials.","solutions":["Run the connector setup (check_status/build_config flow) and provide the required fields (typically api_key and base_url) via save_config","If a config file exists, verify it isn't being parsed into an empty config (see error 1310)","In code, check _missing_fields(config) or config completeness before calling API helpers"],"exampleFix":"# before\nconfig = load_config()\npositions = get_positions(config)  # raises if unconfigured\n# after\nmissing = _missing_fields(config)\nif missing:\n    ...  # run setup / prompt user\npositions = get_positions(config)","handlingStrategy":"validation","validationCode":"from trading.connectors.trading212.sdk import _missing_fields, load_config\n\nconfig = load_config()\nmissing = _missing_fields(config)\nif missing:\n    raise SystemExit(f\"finish connector setup first; missing: {missing}\")","typeGuard":"from typing import Any\nfrom trading.connectors.trading212.sdk import _missing_fields, Trading212Config\n\ndef is_configured(config: Trading212Config) -> bool:\n    return not _missing_fields(config)","tryCatchPattern":"try:\n    data = get_positions(config)\nexcept Trading212ConfigError as exc:\n    if \"not configured\" in str(exc):\n        ...  # route user to setup flow\n    raise","preventionTips":["Call check_status() at app startup and surface missing fields to the user","Gate API calls behind an is_configured check in UI/tests","Fail fast in CI with a clear message instead of hitting API helpers"],"tags":["trading212","config","missing-fields","precondition"],"backgroundTag":"missing-configuration","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}