{"record":{"id":"5f9ca1d2f58792d4","repo":"QuantConnect/Lean","slug":"asynchronous-universe-setting-is-not-supported-for","errorCode":null,"errorMessage":"Asynchronous universe setting is not supported for coarse & fine selections, please use the new Fundamental single pass selection","messagePattern":"Asynchronous universe setting is not supported for coarse & fine selections, please use the new Fundamental single pass selection","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"Algorithm.Framework/Selection/FundamentalUniverseSelectionModel.py","lineNumber":53,"sourceCode":"    def create_universes(self, algorithm: QCAlgorithm) -> list[Universe]:\n        '''Creates a new fundamental universe using this class's selection functions\n        Args:\n            algorithm: The algorithm instance to create universes for\n        Returns:\n            The universe defined by this model'''\n        if self.fundamental_data:\n            universe_settings = algorithm.universe_settings if self.universe_settings is None else self.universe_settings\n            # handle both 'Select' and 'select' for backwards compatibility\n            selection = lambda fundamental: self.select(algorithm, fundamental)\n            if hasattr(self, \"Select\") and callable(self.Select):\n                selection = lambda fundamental: self.Select(algorithm, fundamental)\n            universe = FundamentalUniverseFactory(self.market, universe_settings, selection)\n            return [universe]\n        else:\n            universe = self.create_coarse_fundamental_universe(algorithm)\n            if self.filter_fine_data:\n                if universe.universe_settings.asynchronous:\n                    raise ValueError(\"Asynchronous universe setting is not supported for coarse & fine selections, please use the new Fundamental single pass selection\")\n                selection = lambda fine: self.select_fine(algorithm, fine)\n                if hasattr(self, \"SelectFine\") and callable(self.SelectFine):\n                    selection = lambda fine: self.SelectFine(algorithm, fine)\n                universe = FineFundamentalFilteredUniverse(universe, selection)\n            return [universe]\n\n\n    def create_coarse_fundamental_universe(self, algorithm: QCAlgorithm) -> Universe:\n        '''Creates the coarse fundamental universe object.\n        This is provided to allow more flexibility when creating coarse universe.\n        Args:\n            algorithm: The algorithm instance\n        Returns:\n            The coarse fundamental universe'''\n        universe_settings = algorithm.universe_settings if self.universe_settings is None else self.universe_settings\n        return CoarseFundamentalUniverse(universe_settings, lambda coarse: self.filtered_select_coarse(algorithm, coarse))\n\n","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/QuantConnect/Lean/blob/d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892/Algorithm.Framework/Selection/FundamentalUniverseSelectionModel.py#L35-L71","documentation":"FundamentalUniverseSelectionModel (Python) builds a two-stage coarse→fine universe when fundamental_data is false. Lean does not support asynchronous universe settings for paired coarse+fine selection (the fine pass needs the coarse results synchronously), so if the universe_settings.asynchronous flag is true it raises ValueError.","triggerScenarios":"create_coarse_fundamental_universe() returns a universe whose universe_settings.asynchronous is True, and filter_fine_data is True, so a FineFundamentalFilteredUniverse would be layered on top of an async coarse universe.","commonSituations":"Overriding algorithm.set_universe_settings(...) with UniverseSettings(asynchronous=True), or passing a custom universe_settings object with asynchronous=True into the model while still using coarse+fine.","solutions":["Disable asynchronous selection: set UniverseSettings(..., asynchronous=False) (or omit it) for coarse+fine models.","Switch to the single-pass Fundamental universe by setting the model's fundamental_data flag / using FundamentalUniverseSelectionModel's fundamental path, which supports async selection."],"exampleFix":"# before\nself.set_universe_settings(UniverseSettings(asynchronous=True))\nself.set_universe_selection(FundamentalUniverseSelectionModel(..., filter_fine_data=True))  # raises\n\n# after (coarse+fine, sync)\nself.set_universe_settings(UniverseSettings(asynchronous=False))\n# OR single-pass fundamental (async-safe):\n# use a FundamentalUniverseSelectionModel subclass with fundamental_data enabled","handlingStrategy":"validation","validationCode":"# Ensure coarse+fine uses synchronous selection\nsettings = algorithm.universe_settings\nif getattr(settings, 'asynchronous', False) and using_coarse_fine:\n    raise ValueError('Disable asynchronous universe settings for coarse+fine, or use single-pass Fundamental')","typeGuard":"def is_async_safe_for_coarse_fine(settings, fundamental_data: bool, filter_fine: bool) -> bool:\n    if not fundamental_data and filter_fine:\n        return not getattr(settings, 'asynchronous', False)\n    return True","tryCatchPattern":null,"preventionTips":["Leave UniverseSettings.asynchronous False when using coarse+fine selection.","Use the single-pass Fundamental universe if you need asynchronous selection."],"tags":["universe-selection","configuration","fundamentals"],"backgroundTag":null,"analyzedSha":"d2c3659f877bfc2b5d9dc0fc89a9c7566f45e892","analyzedAt":"2026-08-13T13:52:21.013Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}