HKUDS/Vibe-Trading · error · FutuProfileMismatchError

Configured acc_id {cfg.acc_id} was not found in the OpenD ac

Error message

Configured acc_id {cfg.acc_id} was not found in the OpenD account list.

What it means

Raised by _resolve_acc_id when the acc_id set in FutuConfig does not appear in the account list returned by OpenD, meaning the SDK cannot select the trading account.

Source

Thrown at agent/src/trading/connectors/futu/sdk.py:1054

    Args:
        cfg: Effective connector config.
        trade_ctx: An open ``OpenSecTradeContext``.

    Returns:
        The resolved Futu account id.

    Raises:
        FutuProfileMismatchError: If the configured account's ``trd_env`` does
            not match the profile, or no account matches the profile env.
    """
    rows = _records(_unwrap(trade_ctx.get_acc_list()))
    want = cfg.trd_env_name
    matching = [row for row in rows if _trd_env_of(row) == want]

    if cfg.acc_id:
        target = next((row for row in rows if _acc_id_of(row) == cfg.acc_id), None)
        if target is None:
            raise FutuProfileMismatchError(
                f"Configured acc_id {cfg.acc_id} was not found in the OpenD account list."
            )
        if _trd_env_of(target) != want:
            raise FutuProfileMismatchError(
                f"Configured acc_id {cfg.acc_id} has trd_env {_trd_env_of(target)!r}, "
                f"but profile {cfg.profile!r} requires {want!r}. "
                "Select a profile that matches this account's environment."
            )
        return cfg.acc_id

    if not matching:
        raise FutuProfileMismatchError(
            f"No Futu account with trd_env {want!r} was found for profile {cfg.profile!r}. "
            "Confirm OpenD is logged into the expected account."
        )
    return _acc_id_of(matching[0])

View on GitHub (pinned to 80ffdda44c)

Solutions

  1. Remove or update acc_id in the config so the SDK auto-resolves from the account list
  2. Fetch the current account list from OpenD and set the correct acc_id
  3. Confirm OpenD is logged into the intended Futu account

Example fix

// before
{ "profile": "paper", "acc_id": 123456 }  // old account
// after
{ "profile": "paper" }  // let SDK resolve, or set current acc_id
Defensive patterns

Strategy: validation

Validate before calling

rows = list_opend_accounts()  # via OpenD GetFunds|acct list
known = {_acc_id_of(r) for r in rows}
if cfg.acc_id and cfg.acc_id not in known:
    clear_or_update_acc_id()

Try / catch

try:
    snap = get_account_snapshot()
except FutuProfileMismatchError as exc:
    if 'not found in the OpenD account list' in str(exc):
        reconfigure_acc_id()  # prompt user / auto-resolve
    raise

Prevention

When it happens

Trigger: Config carries a stale/wrong acc_id after switching Futu accounts, account closed, or config copied between environments (paper account id used against live profile).

Common situations: Rotating Futu accounts, re-logging OpenD into a different account, copying config files between machines, acc_id typo.

Related errors


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