{"record":{"id":"5092de9d1d1a4e43","repo":"HKUDS/Vibe-Trading","slug":"configured-profile-is-live-but-the-account-number","errorCode":null,"errorMessage":"Configured profile is live, but the account number is a 17-digit Tiger paper account. Select a paper profile for paper accounts.","messagePattern":"Configured profile is live, but the account number is a 17-digit Tiger paper account\\. Select a paper profile for paper accounts\\.","errorType":"exception","errorClass":"TigerProfileMismatchError","httpStatus":null,"severity":"critical","filePath":"agent/src/trading/connectors/tiger/sdk.py","lineNumber":603,"sourceCode":"    _require_tigeropen()\n    from tigeropen.quote.quote_client import QuoteClient  # type: ignore\n\n    return QuoteClient(_client_config(cfg))\n\n\ndef _assert_profile(cfg: TigerConfig) -> None:\n    \"\"\"Fail closed when the account does not match the declared environment.\"\"\"\n    account = (cfg.account or \"\").strip()\n    if not account:\n        raise TigerConfigError(\"Tiger account number is not configured\")\n    paper = is_paper_account(account)\n    if cfg.environment == \"paper\" and not paper:\n        raise TigerProfileMismatchError(\n            \"Configured profile is paper, but the account number is not a 17-digit Tiger paper account. \"\n            \"Use a live profile only if you intend live-account access.\"\n        )\n    if cfg.environment == \"live\" and paper:\n        raise TigerProfileMismatchError(\n            \"Configured profile is live, but the account number is a 17-digit Tiger paper account. \"\n            \"Select a paper profile for paper accounts.\"\n        )\n\n\ndef _missing_fields(cfg: TigerConfig) -> list[str]:\n    missing = []\n    if not cfg.tiger_id:\n        missing.append(\"tiger_id\")\n    if not cfg.private_key_path:\n        missing.append(\"private_key_path\")\n    if not cfg.account:\n        missing.append(\"account\")\n    return missing\n\n\ndef _public_config(cfg: TigerConfig) -> dict[str, Any]:\n    \"\"\"Config snapshot with credential material masked (key path only, never contents).\"\"\"","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/tiger/sdk.py#L585-L621","documentation":"The inverse of the paper mismatch: _assert_profile raises TigerProfileMismatchError when profile is 'live' but is_paper_account(account) is true, i.e. the configured account is a 17-digit paper account. This blocks code that believes it is operating on a live account from silently running against the paper environment.","triggerScenarios":"Any Tiger operation with profile='live' (or 'live-readonly' is not checked here — only 'live' triggers this branch) while cfg.account is a 17-digit Tiger paper account number.","commonSituations":"Switching a config from paper to live by editing only the profile and forgetting to update the account; reusing paper credentials after a go-live; account field populated from a paper fixture during a production deploy.","solutions":["If you intend paper trading, set profile back to 'paper' to match the 17-digit account","If you intend live, replace account with your real live account number from the Tiger portal","Keep one config file per environment to avoid half-migrated edits"],"exampleFix":"// before\n{\"profile\": \"live\", \"account\": \"20190129101234567\"}  // 17-digit paper account\n\n// after\n{\"profile\": \"paper\", \"account\": \"20190129101234567\"}","handlingStrategy":"validation","validationCode":"from agent.src.trading.connectors.tiger.sdk import is_paper_account\n\ndef live_profile_is_really_live(cfg) -> bool:\n    return not (cfg.environment == 'live' and is_paper_account((cfg.account or '').strip()))","typeGuard":"def assert_live_not_paper(cfg: TigerConfig) -> None:\n    if cfg.environment == 'live' and is_paper_account(cfg.account.strip()):\n        raise ValueError('live profile configured with a paper account number')","tryCatchPattern":"try:\n    place_or_read_live(cfg)\nexcept TigerProfileMismatchError as exc:\n    logger.critical('Refusing to proceed: %s', exc)\n    abort_run()","preventionTips":["Treat profile changes as a two-field review (profile + account together)","Add a CI check that live configs never contain 17-digit accounts","Log the resolved environment at startup so mismatches are visible early"],"tags":["tiger","profile-mismatch","live-trading","safety-check"],"backgroundTag":"environment-profile-mismatch","analyzedSha":"80ffdda44c5c4db0dd84d70e051cca591cea67df","analyzedAt":"2026-08-28T12:46:38.989Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}