OpenBB-finance/OpenBB · error · OpenBBError

Invalid industry ' '. Available industries are

Error message

Invalid industry '{v}'. Available industries are:
{', '.join(INDUSTRY_MAP)}

What it means

Finviz equity screener query params validator rejects the `industry` field when the value is not a key of INDUSTRY_MAP. The message lists all valid industry names. It fires during pydantic validation, before any HTTP request, so no API quota is consumed.

Solutions

  1. Pick the exact industry name from the INDUSTRY_MAP list printed in the error
  2. Validate against openbb_finviz INDUSTRY_MAP programmatically before constructing the query
  3. Fuzzy-match user input to the closest key when accepting free-form input

Example fix

# before
q = FinvizEquityScreenerQueryParams(industry="Tech")  # not in INDUSTRY_MAP

# after
from openbb_finviz.utils.reference_data import INDUSTRY_MAP  # dict name->no
match = [k for k in INDUSTRY_MAP if "software" in k.lower()]
q = FinvizEquityScreenerQueryParams(industry=match[0])
Defensive patterns

Strategy: validation

Validate before calling

from openbb_finviz.utils.reference_data import INDUSTRY_MAP

if industry is not None and industry not in INDUSTRY_MAP:
    candidates = [k for k in INDUSTRY_MAP if industry.lower() in k.lower()]
    industry = candidates[0] if len(candidates) == 1 else None
assert industry is None or industry in INDUSTRY_MAP

Type guard

def is_valid_industry(v: str | None) -> bool:
    return v is None or v in INDUSTRY_MAP

Try / catch

from openbb_core.app.model.obb_error import OpenBBError

try:
    q = FinvizEquityScreenerQueryParams(industry=industry)
except OpenBBError as e:
    raise ValueError(f"Fix industry selection: {e}") from e

Prevention

When it happens

Trigger: Passing industry='Technology' (not a valid Finviz industry name; Finviz uses granular names like 'Software - Application'); mismatched casing/punctuation; industries renamed between finvizfinance versions.

Common situations: Users assuming GICS or Yahoo sector/industry vocabulary; hard-coded industry strings that broke when the Finviz taxonomy changed; copy-paste from the Finviz UI that introduces trailing spaces.

Related errors


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

Appendix: source

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

        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."""
        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."""

View on GitHub (pinned to 3e071fcc2c)