OpenBB-finance/OpenBB · error · OpenBBError

Invalid preset '{preset}'. Available presets are: {list(pres

Error message

Invalid preset '{preset}'. Available presets are:
{list(preset_choices)}

What it means

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.

Source

Thrown at openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py:578

        )
        from numpy import nan
        from openbb_core.provider.utils.helpers import get_requests_session
        from openbb_finviz.utils.screener_helper import (
            get_preset_choices,
            d_check_screener,
            d_signals,
        )
        from pandas import DataFrame

        preset = None
        util.session = get_requests_session()

        try:
            data_dir = kwargs.get("preferences", {}).get("data_directory")
            preset_choices = get_preset_choices(data_dir)
            preset = query.preset
            if preset is not None and preset not in preset_choices:
                raise OpenBBError(
                    f"Invalid preset '{preset}'. Available presets are:\n{list(preset_choices)}"
                )
        except Exception as e:
            if preset is not None:
                raise e from e
            warn(f"Error loading presets -> {e.__class__.__name__}: {e}")
            preset = None

        data_type = query.metric
        ascend = False
        limit = query.limit
        sleep = 0.1  # For optimized pagination speed without creating too many requests error from Finviz.
        sort_by = "Change"
        df_screen = DataFrame()
        screen_type = {
            "overview": overview.Overview,
            "valuation": valuation.Valuation,
            "financial": financial.Financial,

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Check the preset list printed in the error and fix the name
  2. Put your INI in the data_directory configured in OpenBB preferences and confirm the path is used
  3. Run get_preset_choices(data_directory) yourself to see what the provider actually discovers
  4. Omit preset and pass filters_dict directly if you do not need INI files

Example fix

# before
obb.user.preferences.data_directory = "/wrong/path"
await obb.equity.screener(provider="finviz", preset="my_screen")  # not found

# after
obb.user.preferences.data_directory = "~/.openbb/presets"  # contains my_screen.ini
await obb.equity.screener(provider="finviz", preset="my_screen")
Defensive patterns

Strategy: validation

Validate before calling

from openbb_finviz.utils.screener_helper import get_preset_choices

choices = get_preset_choices(data_dir)
assert preset is None or preset in choices, f"preset must be one of {list(choices)}"

Try / catch

from openbb_core.app.model.obb_error import OpenBBError

try:
    await obb.equity.screener(provider="finviz", preset=preset)
except OpenBBError as e:
    if "Available presets" in str(e):
        # list them back to the user / fall back to no preset
        preset = None
    raise

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/aeb44ab9076ab42e. Report an issue: GitHub.