OpenBB-finance/OpenBB · error · OpenBBError
Invalid preset '{v}'. Please rename the file to use as a pre
Error message
Invalid preset '{v}'. Please rename the file to use as a preset. What it means
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.
Source
Thrown at openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py:150
)
return v if v else None
@field_validator("industry", mode="before", check_fields=False)
@classmethod
def validate_industry(cls, v):
"""Validate the industry."""
if v is not None and v not in INDUSTRY_MAP:
raise OpenBBError(
f"Invalid industry '{v}'. Available industries are:\n{', '.join(INDUSTRY_MAP)}"
)
return v if v else None
@field_validator("preset", mode="before", check_fields=False)
@classmethod
def validate_preset(cls, v):
"""Check to reject running template file."""
if v is not None and v == "screener_template":
raise OpenBBError(
f"Invalid preset '{v}'. Please rename the file to use as a preset."
)
return v if v else None
@field_validator("filters_dict", mode="before", check_fields=False)
@classmethod
def validate_filters_dict(cls, v):
"""Validate the filters_dict."""
if isinstance(v, str):
# pylint: disable=import-outside-toplevel
import json
try:
v = json.loads(v)
except json.JSONDecodeError as e:
raise OpenBBError(f"Invalid JSON format for 'filters_dict': {e}") from e
if v is not None and not isinstance(v, dict):
raise OpenBBError(View on GitHub (pinned to 3e071fcc2c)
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
Example fix
# before # data_directory/screener_template.ini (edited in place) q = FinvizEquityScreenerQueryParams(preset="screener_template") # rejected # after # mv data_directory/screener_template.ini data_directory/my_strategy.ini q = FinvizEquityScreenerQueryParams(preset="my_strategy")
Defensive patterns
Strategy: validation
Validate before calling
if preset == "screener_template":
raise ValueError("Copy the template to a new name (e.g. my_strategy.ini) before use") Try / catch
from openbb_core.app.model.obb_error import OpenBBError
try:
q = FinvizEquityScreenerQueryParams(preset=preset)
except OpenBBError as e:
if "screener_template" in str(e):
print("Rename your INI copy; do not run the shipped template directly")
raise Prevention
- Never edit screener_template.ini in place; always work on a renamed copy
- Add a startup check rejecting the literal preset name 'screener_template'
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid preset '{preset}'. Available presets are: {list(pres
- The screener variable {section}.{key} shouldn't exist!
- Invalid [{section}] {key}={val}. Choose one of the following
- Invalid signal '{v}'. Available signals are: {SIGNALS_DESC_S
- Invalid industry '{v}'. Available industries are: {', '.join
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/307bd4ab02f4bd45.
Report an issue: GitHub.