{"record":{"id":"725e00b38fbd06ad","repo":"HKUDS/Vibe-Trading","slug":"configured-profile-is-paper-but-the-account-numbe","errorCode":null,"errorMessage":"Configured profile is paper, but the account number is not a 17-digit Tiger paper account. Use a live profile only if you intend live-account access.","messagePattern":"Configured profile is paper, but the account number is not a 17-digit Tiger paper account\\. Use a live profile only if you intend live-account access\\.","errorType":"exception","errorClass":"TigerProfileMismatchError","httpStatus":null,"severity":"critical","filePath":"agent/src/trading/connectors/tiger/sdk.py","lineNumber":598,"sourceCode":"\n    return TradeClient(_client_config(cfg))\n\n\ndef _quote_client(cfg: TigerConfig):\n    _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\")","sourceCodeStart":580,"sourceCodeEnd":616,"githubUrl":"https://github.com/HKUDS/Vibe-Trading/blob/80ffdda44c5c4db0dd84d70e051cca591cea67df/agent/src/trading/connectors/tiger/sdk.py#L580-L616","documentation":"_assert_profile cross-checks the declared profile against the account number shape: Tiger paper accounts are 17-digit numbers (detected via is_paper_account). When profile is 'paper' but the account does not match the paper pattern, it raises TigerProfileMismatchError to prevent accidentally hitting a live account under paper assumptions.","triggerScenarios":"Any Tiger operation (check_status, get_positions, get_quote, ...) with profile='paper' while cfg.account is a real live account number (not 17-digit paper format), or a paper account number that was mistyped so it no longer matches the 17-digit pattern.","commonSituations":"Copying a live account number into a config while leaving profile 'paper' (the default); misunderstanding that paper mode requires Tiger's dedicated paper account, not your live credentials; typos truncating the 17-digit paper account id.","solutions":["If you meant live trading/read-only, change profile to 'live-readonly' or 'live' to match the account","If you meant paper, replace account with your Tiger paper account number (17 digits) from the paper-trading section of the portal","Double-check the account string for missing/extra digits (must be exactly 17 digits for paper)"],"exampleFix":"// before\n{\"profile\": \"paper\", \"account\": \"35126589\"}  // live account under paper profile\n\n// after\n{\"profile\": \"live-readonly\", \"account\": \"35126589\"}","handlingStrategy":"validation","validationCode":"from agent.src.trading.connectors.tiger.sdk import is_paper_account\n\ndef profile_matches_account(cfg) -> bool:\n    paper = is_paper_account((cfg.account or '').strip())\n    if cfg.environment == 'paper':\n        return paper\n    return True","typeGuard":"def is_paper_account(account: str) -> bool:\n    return bool(account) and account.isdigit() and len(account) == 17","tryCatchPattern":"try:\n    get_positions(cfg)\nexcept TigerProfileMismatchError as exc:\n    logger.error('Profile/account mismatch: %s', exc)\n    # stop and require human confirmation before changing anything","preventionTips":["Derive the profile from the account number programmatically instead of hand-setting it","Keep separate config files per environment (paper.json / live.json)","Never default to paper while copying live account numbers between environments"],"tags":["tiger","profile-mismatch","paper-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"}