{"record":{"id":"307bd4ab02f4bd45","repo":"OpenBB-finance/OpenBB","slug":"invalid-preset-v-please-rename-the-file-to-us","errorCode":null,"errorMessage":"Invalid preset '{v}'. Please rename the file to use as a preset.","messagePattern":"Invalid preset '(.+?)'\\. Please rename the file to use as a preset\\.","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py","lineNumber":150,"sourceCode":"            )\n        return v if v else None\n\n    @field_validator(\"industry\", mode=\"before\", check_fields=False)\n    @classmethod\n    def validate_industry(cls, v):\n        \"\"\"Validate the industry.\"\"\"\n        if v is not None and v not in INDUSTRY_MAP:\n            raise OpenBBError(\n                f\"Invalid industry '{v}'. Available industries are:\\n{', '.join(INDUSTRY_MAP)}\"\n            )\n        return v if v else None\n\n    @field_validator(\"preset\", mode=\"before\", check_fields=False)\n    @classmethod\n    def validate_preset(cls, v):\n        \"\"\"Check to reject running template file.\"\"\"\n        if v is not None and v == \"screener_template\":\n            raise OpenBBError(\n                f\"Invalid preset '{v}'. Please rename the file to use as a preset.\"\n            )\n        return v if v else None\n\n    @field_validator(\"filters_dict\", mode=\"before\", check_fields=False)\n    @classmethod\n    def validate_filters_dict(cls, v):\n        \"\"\"Validate the filters_dict.\"\"\"\n        if isinstance(v, str):\n            # pylint: disable=import-outside-toplevel\n            import json\n\n            try:\n                v = json.loads(v)\n            except json.JSONDecodeError as e:\n                raise OpenBBError(f\"Invalid JSON format for 'filters_dict': {e}\") from e\n        if v is not None and not isinstance(v, dict):\n            raise OpenBBError(","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py#L132-L168","documentation":"Finviz equity screener rejects a preset literally named 'screener_template'. That filename ships with finvizfinance as the stock template users are supposed to copy and edit, so running it directly would return unfiltered defaults. The validator forces you to rename your customized copy.","triggerScenarios":"Creating a copy of screener_template.ini without renaming it, then passing preset='screener_template'; defaulting the preset argument to the template name in a config.","commonSituations":"New users copying the bundled template into their data_directory but forgetting the rename step documented in finvizfinance; scripts that template the preset name from a fixed string.","solutions":["Rename your INI file to something else, e.g. my_strategy.ini, and pass preset='my_strategy'","Keep the original screener_template.ini untouched as a reference and always edit a renamed copy"],"exampleFix":"# before\n# data_directory/screener_template.ini  (edited in place)\nq = FinvizEquityScreenerQueryParams(preset=\"screener_template\")  # rejected\n\n# after\n# mv data_directory/screener_template.ini data_directory/my_strategy.ini\nq = FinvizEquityScreenerQueryParams(preset=\"my_strategy\")","handlingStrategy":"validation","validationCode":"if preset == \"screener_template\":\n    raise ValueError(\"Copy the template to a new name (e.g. my_strategy.ini) before use\")","typeGuard":null,"tryCatchPattern":"from openbb_core.app.model.obb_error import OpenBBError\n\ntry:\n    q = FinvizEquityScreenerQueryParams(preset=preset)\nexcept OpenBBError as e:\n    if \"screener_template\" in str(e):\n        print(\"Rename your INI copy; do not run the shipped template directly\")\n    raise","preventionTips":["Never edit screener_template.ini in place; always work on a renamed copy","Add a startup check rejecting the literal preset name 'screener_template'"],"tags":["openbb","finviz","validation","preset","config"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}