{"record":{"id":"476985a2a1f6e027","repo":"microsoft/qlib","slug":"this-type-of-input-is-not-supported-476985","errorCode":null,"errorMessage":"This type of input is not supported","messagePattern":"This type of input is not supported","errorType":"exception","errorClass":"NotImplementedError","httpStatus":null,"severity":"error","filePath":"qlib/data/dataset/loader.py","lineNumber":107,"sourceCode":"\n        if self.is_group:\n            self.fields = {grp: self._parse_fields_info(fields_info) for grp, fields_info in config.items()}\n        else:\n            self.fields = self._parse_fields_info(config)\n\n    def _parse_fields_info(self, fields_info: Union[list, tuple]) -> Tuple[list, list]:\n        if len(fields_info) == 0:\n            raise ValueError(\"The size of fields must be greater than 0\")\n\n        if not isinstance(fields_info, (list, tuple)):\n            raise TypeError(\"Unsupported type\")\n\n        if isinstance(fields_info[0], str):\n            exprs = names = fields_info\n        elif isinstance(fields_info[0], (list, tuple)):\n            exprs, names = fields_info\n        else:\n            raise NotImplementedError(f\"This type of input is not supported\")\n        return exprs, names\n\n    @abc.abstractmethod\n    def load_group_df(\n        self,\n        instruments,\n        exprs: list,\n        names: list,\n        start_time: Union[str, pd.Timestamp] = None,\n        end_time: Union[str, pd.Timestamp] = None,\n        gp_name: str = None,\n    ) -> pd.DataFrame:\n        \"\"\"\n        load the dataframe for specific group\n\n        Parameters\n        ----------\n        instruments :","sourceCodeStart":89,"sourceCodeEnd":125,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/data/dataset/loader.py#L89-L125","documentation":"Inside a valid list/tuple fields config, `_parse_fields_info` inspects the first element to decide the shape: a str means 'list of expressions used as both exprs and names'; a list/tuple means a (exprs, names) pair. A first element of any other type (int, dict, None, nested further) raises NotImplementedError.","triggerScenarios":"Passing fields=[[ ['$close'], ['close'] ]] (over-nested), fields=[{'expr': '$close'}] (dicts), or fields=[0, 1]. Also passing (['$close'], ['close'], 'extra') — first element fine, but a 3-tuple unpack fails elsewhere; the direct trigger is a non-str non-list first element.","commonSituations":"Building (exprs, names) pairs programmatically and wrapping once too many times; mixing per-group dict configs into the fields list.","solutions":["Use the flat form: fields=['$close', '$open'].","Or exactly one nesting level for names: fields=(['$close', '$open'], ['close', 'open']).","Print repr(fields[0]) and ensure it is a str or a list/tuple."],"exampleFix":"# before\nfields = [[['Ref($close, -1)'], ['label']]]\n\n# after\nfields = (['Ref($close, -1)'], ['label'])","handlingStrategy":"type-guard","validationCode":"def valid_fields_shape(cfg) -> bool:\n    if isinstance(cfg, dict):\n        return all(valid_fields_shape(v) for v in cfg.values())\n    if not isinstance(cfg, (list, tuple)) or len(cfg) == 0:\n        return False\n    head = cfg[0]\n    return isinstance(head, str) or (isinstance(head, (list, tuple)) and len(cfg) == 2)","typeGuard":"def is_valid_fields_info(f) -> bool:\n    if not isinstance(f, (list, tuple)) or not f:\n        return False\n    h = f[0]\n    return isinstance(h, str) or (isinstance(h, (list, tuple)) and len(f) == 2)","tryCatchPattern":null,"preventionTips":["Keep to the two documented shapes: ['expr', ...] or (['expr', ...], ['name', ...]).","When generating (exprs, names), construct the pair exactly once, not nested."],"tags":["fields","loader","type-error"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}