{"record":{"id":"aeb44ab9076ab42e","repo":"OpenBB-finance/OpenBB","slug":"invalid-preset-preset-available-presets-are","errorCode":null,"errorMessage":"Invalid preset '{preset}'. Available presets are:\n{list(preset_choices)}","messagePattern":"Invalid preset '(.+?)'\\. Available presets are:\n(.+?)","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py","lineNumber":578,"sourceCode":"        )\n        from numpy import nan\n        from openbb_core.provider.utils.helpers import get_requests_session\n        from openbb_finviz.utils.screener_helper import (\n            get_preset_choices,\n            d_check_screener,\n            d_signals,\n        )\n        from pandas import DataFrame\n\n        preset = None\n        util.session = get_requests_session()\n\n        try:\n            data_dir = kwargs.get(\"preferences\", {}).get(\"data_directory\")\n            preset_choices = get_preset_choices(data_dir)\n            preset = query.preset\n            if preset is not None and preset not in preset_choices:\n                raise OpenBBError(\n                    f\"Invalid preset '{preset}'. Available presets are:\\n{list(preset_choices)}\"\n                )\n        except Exception as e:\n            if preset is not None:\n                raise e from e\n            warn(f\"Error loading presets -> {e.__class__.__name__}: {e}\")\n            preset = None\n\n        data_type = query.metric\n        ascend = False\n        limit = query.limit\n        sleep = 0.1  # For optimized pagination speed without creating too many requests error from Finviz.\n        sort_by = \"Change\"\n        df_screen = DataFrame()\n        screen_type = {\n            \"overview\": overview.Overview,\n            \"valuation\": valuation.Valuation,\n            \"financial\": financial.Financial,","sourceCodeStart":560,"sourceCodeEnd":596,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py#L560-L596","documentation":"At fetch time the Finviz screener resolves `preset` against the available preset INI files (bundled ones plus any in the configured data_directory). If the name is not among preset_choices it raises OpenBBError listing what is available. Note the surrounding try/except: the error is re-raised only when a preset was requested; if preset discovery itself failed, it degrades to a warning and preset=None.","triggerScenarios":"preset='my_screen' when my_screen.ini is not in the data_directory; data_directory preference not set or pointing at the wrong path; typo in the preset name; forgetting the .ini extension mismatch (name must match the filename stem).","commonSituations":"User credentials/preferences not carrying the data_directory; running in a new environment where custom presets were never copied; casing differences between the passed name and the filename.","solutions":["Check the preset list printed in the error and fix the name","Put your INI in the data_directory configured in OpenBB preferences and confirm the path is used","Run get_preset_choices(data_directory) yourself to see what the provider actually discovers","Omit preset and pass filters_dict directly if you do not need INI files"],"exampleFix":"# before\nobb.user.preferences.data_directory = \"/wrong/path\"\nawait obb.equity.screener(provider=\"finviz\", preset=\"my_screen\")  # not found\n\n# after\nobb.user.preferences.data_directory = \"~/.openbb/presets\"  # contains my_screen.ini\nawait obb.equity.screener(provider=\"finviz\", preset=\"my_screen\")","handlingStrategy":"validation","validationCode":"from openbb_finviz.utils.screener_helper import get_preset_choices\n\nchoices = get_preset_choices(data_dir)\nassert preset is None or preset in choices, f\"preset must be one of {list(choices)}\"","typeGuard":null,"tryCatchPattern":"from openbb_core.app.model.obb_error import OpenBBError\n\ntry:\n    await obb.equity.screener(provider=\"finviz\", preset=preset)\nexcept OpenBBError as e:\n    if \"Available presets\" in str(e):\n        # list them back to the user / fall back to no preset\n        preset = None\n    raise","preventionTips":["Keep custom preset INIs inside the configured data_directory and version them with your code","Verify preset discovery with get_preset_choices after environment changes","Match the preset argument exactly to the INI filename stem"],"tags":["openbb","finviz","preset","config","screener"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}