{"record":{"id":"a71a3af26a244745","repo":"microsoft/qlib","slug":"freq-freq-missing-group-gp","errorCode":null,"errorMessage":"freq(={freq}) missing group(={_gp})","messagePattern":"freq\\(=(.+?)\\) missing group\\(=(.+?)\\)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"qlib/data/dataset/loader.py","lineNumber":197,"sourceCode":"        \"\"\"\n        self.filter_pipe = filter_pipe\n        self.swap_level = swap_level\n        self.freq = freq\n\n        # sample\n        self.inst_processors = inst_processors if inst_processors is not None else {}\n        assert isinstance(\n            self.inst_processors, (dict, list)\n        ), f\"inst_processors(={self.inst_processors}) must be dict or list\"\n\n        super().__init__(config)\n\n        if self.is_group:\n            # check sample config\n            if isinstance(freq, dict):\n                for _gp in config.keys():\n                    if _gp not in freq:\n                        raise ValueError(f\"freq(={freq}) missing group(={_gp})\")\n                assert (\n                    self.inst_processors\n                ), f\"freq(={self.freq}), inst_processors(={self.inst_processors}) cannot be None/empty\"\n\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        if instruments is None:\n            warnings.warn(\"`instruments` is not set, will load all stocks\")\n            instruments = \"all\"\n        if isinstance(instruments, str):\n            instruments = D.instruments(instruments, filter_pipe=self.filter_pipe)","sourceCodeStart":179,"sourceCodeEnd":215,"githubUrl":"https://github.com/microsoft/qlib/blob/79633dd9506ea689e5400dea0197717b5b3d74b7/qlib/data/dataset/loader.py#L179-L215","documentation":"Raised by StaticDataLoader-style grouped loaders (qlib/data/dataset/loader.py) when the dataset config declares multiple groups (is_group=True) and the freq parameter is a dict, but a group name present in config has no matching key in the freq dict. The loader needs a frequency per group to load each group's dataframe, so a missing entry makes the config incomplete. It is a config-validation error thrown at loader construction, before any data is read.","triggerScenarios":"Calling a grouped data loader (e.g. MultiDataLoader / DataHandlerLP with groups) with config = {'group1': {...}, 'group2': {...}} but freq = {'group1': 'day'} — 'group2' is in config.keys() but not in freq. Also occurs when a group is added to the handler config without updating the matching freq mapping.","commonSituations":"Setting up grouped datasets in qlib workflows (e.g. Alpha158 + Alpha360 groups, or train/valid groups) where handlers and processors are configured per group; typos or case mismatches between group names in config and freq; adding a new group in an experiment notebook and forgetting the freq entry. Note that when freq is a dict, inst_processors must also be non-empty (a separate assert follows).","solutions":["Add the missing group key to the freq dict, e.g. freq = {'group1': 'day', 'group2': 'day'} so every key of config is covered.","Check for exact group-name mismatches (case, whitespace) between config.keys() and freq.keys(); print both dicts to compare.","If you did not intend grouped loading, remove the groups from the dataset/handler config so is_group is False.","When freq is a dict, also supply a non-empty inst_processors mapping (e.g. inst_processors={'group1': [...], ...}) or the following assert will fail."],"exampleFix":"# before\nconfig = {\"price\": {\"kwargs\": {...}}, \"factor\": {\"kwargs\": {...}}}\nfreq = {\"price\": \"day\"}\nloader = NestedGroupStaticDataLoader(config=..., freq=freq)\n\n# after\nfreq = {\"price\": \"day\", \"factor\": \"day\"}  # every config group has a freq entry","handlingStrategy":"validation","validationCode":"missing = set(config.keys()) - set(freq.keys())\nif isinstance(freq, dict) and missing:\n    raise ConfigError(f\"freq dict is missing groups: {missing}\")","typeGuard":null,"tryCatchPattern":"try:\n    loader = GroupedLoader(config=config, freq=freq, inst_processors=procs)\nexcept ValueError as e:\n    if \"missing group\" in str(e):\n        # rebuild freq dict covering config.keys() and retry once\n        freq = {g: freq.get(g, default_freq) for g in config}\n        loader = GroupedLoader(config=config, freq=freq, inst_processors=procs)\n    else:\n        raise","preventionTips":["Derive the freq dict programmatically from config.keys() instead of writing it by hand.","Assert set(config) <= set(freq) in test/setup code before constructing grouped loaders.","Keep group names in one constant list reused by both config and freq construction."],"tags":["qlib","dataset","config","group","validation"],"backgroundTag":null,"analyzedSha":"79633dd9506ea689e5400dea0197717b5b3d74b7","analyzedAt":"2026-08-15T07:01:27.511Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}