OpenBB-finance/OpenBB · error · OpenBBError

Invalid signal '{v}'. Available signals are: {SIGNALS_DESC_S

Error message

Invalid signal '{v}'. Available signals are:
{SIGNALS_DESC_STR}

What it means

Finviz equity screener query params validator rejects the `signal` field when its value is not a key of the SIGNALS mapping. The error message enumerates every valid signal via SIGNALS_DESC_STR. This fires at query-model construction time (pydantic field_validator, mode='before'), before any network call.

Source

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

    )
    filters_dict: dict | str | None = Field(
        default=None,
        kw_only=True,
        description="A formatted dictionary, or serialized JSON string, of additional filters to apply to the query."
        + " This parameter can be used as an alternative to preset files, and is ignored when a preset is supplied."
        + " Invalid entries will raise an error. Syntax should follow the 'screener_template.ini' file.",
    )
    limit: int | None = Field(
        default=None,
        description=QUERY_DESCRIPTIONS.get("limit", ""),
    )

    @field_validator("signal", mode="before", check_fields=False)
    @classmethod
    def validate_signal(cls, v):
        """Validate the signal."""
        if v is not None and v not in SIGNALS:
            raise OpenBBError(
                f"Invalid signal '{v}'. Available signals are:\n{SIGNALS_DESC_STR}"
            )
        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."""

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Use a signal name exactly as listed in SIGNALS_DESC_STR in the error output
  2. Validate user input against openbb_finviz.utils.reference_data.SIGNALS before building the query
  3. Normalize input (strip/casefold) and map it to the canonical Finviz signal name

Example fix

# before
q = FinvizEquityScreenerQueryParams(signal="top gainers")  # wrong casing -> OpenBBError

# after
from openbb_finviz.utils.reference_data import SIGNALS
sig = next((s for s in SIGNALS if s.casefold() == user_input.casefold()), None)
if sig is None:
    raise ValueError(f"unknown signal: {user_input}")
q = FinvizEquityScreenerQueryParams(signal=sig)
Defensive patterns

Strategy: validation

Validate before calling

from openbb_finviz.utils.reference_data import SIGNALS

if signal is not None and signal not in SIGNALS:
    raise ValueError(f"Pick one of: {', '.join(SIGNALS)}")
q = FinvizEquityScreenerQueryParams(signal=signal)

Type guard

def is_valid_signal(v: str | None) -> bool:
    return v is None or v in SIGNALS

Try / catch

from openbb_core.app.model.obb_error import OpenBBError

try:
    q = FinvizEquityScreenerQueryParams(signal=signal)
except OpenBBError as e:
    # message already enumerates valid signals; surface to user input form
    raise HTTPException(400, str(e)) from e

Prevention

When it happens

Trigger: Passing signal='Top Gainers' or any free-text not in SIGNALS; case or spelling mismatches ('top_gainers' vs 'Top Gainers'); passing an empty string (coerced to None, which is allowed) vs a wrong non-empty string.

Common situations: Porting signal names from another provider's vocabulary; user-supplied signal strings from a config file or CLI that were never checked against the Finviz signal list.

Related errors


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