{"record":{"id":"454a6fa8598c9278","repo":"microsoft/qlib","slug":"type-is-invalid","errorCode":null,"errorMessage":"type is invalid, {}","messagePattern":"type is invalid, (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/contrib/online/operator.py","lineNumber":186,"sourceCode":"                trade_date=trade_date,\r\n            )\r\n            self.logger.info(\"execute order list at {} for {}\".format(trade_date.date(), user_id))\r\n\r\n    def update(self, date, path, type=\"SIM\"):\r\n        \"\"\"Update account at 'date'.\r\n\r\n        Parameters\r\n        ----------\r\n        date : str (YYYY-MM-DD)\r\n            Trade date, that the generated order list will be traded.\r\n        path : str\r\n            Path to save user account.\r\n        type : str\r\n            which executor was been used to execute the order list\r\n            'SIM': SimulatorExecutor()\r\n        \"\"\"\r\n        if type not in [\"SIM\", \"YC\"]:\r\n            raise ValueError(\"type is invalid, {}\".format(type))\r\n        um, pred_date, trade_date = self.init(self.client, path, date)\r\n        for user_id, user in um.users.items():\r\n            dates, trade_exchange = prepare(um, trade_date, user_id)\r\n            if type == \"SIM\":\r\n                executor = SimulatorExecutor(trade_exchange=trade_exchange)\r\n            else:\r\n                raise ValueError(\"not found executor\")\r\n            # dates[0] is the last_trading_date\r\n            if str(dates[0].date()) > str(pred_date.date()):\r\n                raise ValueError(\r\n                    \"The account data is not newest! last trading date {}, today {}\".format(\r\n                        dates[0].date(), trade_date.date()\r\n                    )\r\n                )\r\n            # load trade info and update account\r\n            trade_info = executor.load_trade_info_from_executed_file(\r\n                user_path=(pathlib.Path(path) / user_id), trade_date=trade_date\r\n            )\r","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/contrib/online/operator.py#L168-L204","documentation":"Raised by OnlineOperator.check (operator.py:186) when the type argument is not 'SIM' or 'YC'. The check step supports a fixed vocabulary of executors; 'SIM' selects SimulatorExecutor, and although 'YC' passes this gate it has no implementation on the current code path (see error 315/316).","triggerScenarios":"Calling op.check(..., type='simulator'), type='backtest', or any string other than exactly 'SIM'/'YC' (the comparison is case-sensitive).","commonSituations":"Passing lowercase variants like 'sim'; guessing an executor name from docs; carrying a config value with different casing from an older/newer version of the API.","solutions":["Use type='SIM' for the simulator executor (exact uppercase).","Double-check casing — 'sim'/'Sim' are rejected.","Do not use 'YC' for now: it passes validation but immediately hits the separate 'not found executor' error."],"exampleFix":"# before\nop.check(date=d, path=p, type=\"simulator\")  # ValueError: type is invalid, simulator\n\n# after\nop.check(date=d, path=p, type=\"SIM\")","handlingStrategy":"type-guard","validationCode":"TYPE = \"SIM\"  # only 'SIM' is actually implemented\nif TYPE not in (\"SIM\",):\n    raise ValueError(f\"unsupported executor type {TYPE!r}\")\nop.check(date=d, path=p, type=TYPE)","typeGuard":"def valid_executor_type(t: str) -> bool:\n    return isinstance(t, str) and t == \"SIM\"","tryCatchPattern":null,"preventionTips":["Use the exact uppercase literal 'SIM'; the check is case-sensitive.","Centralize executor-type constants instead of passing free-form strings.","Remember 'YC' is whitelisted but unimplemented — do not use it."],"tags":["qlib","online-operator","arguments","validation","executor"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}