HKUDS/Vibe-Trading · error · Trading212ConfigError

Trading 212 connector not configured: missing {', '.join(mis

Error message

Trading 212 connector not configured: missing {', '.join(missing)}.

What it means

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.

Source

Thrown at agent/src/trading/connectors/trading212/sdk.py:408

    return _order_refused(cfg, _ORDER_DISABLED_ERROR, order_id=order_id, symbol=symbol)


def _get(config: Trading212Config, path: str, *, params: Mapping[str, Any] | None = None) -> Any:
    """Perform a read-only GET request against the Trading 212 REST API."""
    return _request(config, "GET", path, params=params)


def _request(
    config: Trading212Config,
    method: str,
    path: str,
    *,
    params: Mapping[str, Any] | None = None,
) -> Any:
    """Run an HTTP request and normalize Trading 212 failure modes."""
    missing = _missing_fields(config)
    if missing:
        raise Trading212ConfigError(f"Trading 212 connector not configured: missing {', '.join(missing)}.")

    url = urljoin(f"{config.base_url.rstrip('/')}/", path.lstrip("/"))
    headers = {"Accept": "application/json"}
    auth = None
    if config.api_secret:
        auth = (config.api_key, config.api_secret)
    else:
        headers["Authorization"] = config.api_key
    try:
        response = requests.request(
            method.upper(),
            url,
            headers=headers,
            auth=auth,
            params=dict(params or {}),
            timeout=config.timeout,
        )
    except requests.RequestException as exc:

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Run the connector setup (check_status/build_config flow) and provide the required fields (typically api_key and base_url) via save_config
  2. If a config file exists, verify it isn't being parsed into an empty config (see error 1310)
  3. In code, check _missing_fields(config) or config completeness before calling API helpers

Example fix

# before
config = load_config()
positions = get_positions(config)  # raises if unconfigured
# after
missing = _missing_fields(config)
if missing:
    ...  # run setup / prompt user
positions = get_positions(config)
Defensive patterns

Strategy: validation

Validate before calling

from trading.connectors.trading212.sdk import _missing_fields, load_config

config = load_config()
missing = _missing_fields(config)
if missing:
    raise SystemExit(f"finish connector setup first; missing: {missing}")

Type guard

from typing import Any
from trading.connectors.trading212.sdk import _missing_fields, Trading212Config

def is_configured(config: Trading212Config) -> bool:
    return not _missing_fields(config)

Try / catch

try:
    data = get_positions(config)
except Trading212ConfigError as exc:
    if "not configured" in str(exc):
        ...  # route user to setup flow
    raise

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of HKUDS/Vibe-Trading@80ffdda44c (2026-08-28). Data as JSON: /api/errors/e083b1c0f38dbe45. Report an issue: GitHub.