{"record":{"id":"918b20c45de82061","repo":"OpenBB-finance/OpenBB","slug":"invalid-industry-v-available-industries-are","errorCode":null,"errorMessage":"Invalid industry '{v}'. Available industries are:\n{', '.join(INDUSTRY_MAP)}","messagePattern":"Invalid industry '(.+?)'\\. Available industries are:\n(.+?)","errorType":"validation","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py","lineNumber":140,"sourceCode":"        description=QUERY_DESCRIPTIONS.get(\"limit\", \"\"),\n    )\n\n    @field_validator(\"signal\", mode=\"before\", check_fields=False)\n    @classmethod\n    def validate_signal(cls, v):\n        \"\"\"Validate the signal.\"\"\"\n        if v is not None and v not in SIGNALS:\n            raise OpenBBError(\n                f\"Invalid signal '{v}'. Available signals are:\\n{SIGNALS_DESC_STR}\"\n            )\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.\"\"\"","sourceCodeStart":122,"sourceCodeEnd":158,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py#L122-L158","documentation":"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.","triggerScenarios":"Passing industry='Technology' (not a valid Finviz industry name; Finviz uses granular names like 'Software - Application'); mismatched casing/punctuation; industries renamed between finvizfinance versions.","commonSituations":"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.","solutions":["Pick the exact industry name from the INDUSTRY_MAP list printed in the error","Validate against openbb_finviz INDUSTRY_MAP programmatically before constructing the query","Fuzzy-match user input to the closest key when accepting free-form input"],"exampleFix":"# before\nq = FinvizEquityScreenerQueryParams(industry=\"Tech\")  # not in INDUSTRY_MAP\n\n# after\nfrom openbb_finviz.utils.reference_data import INDUSTRY_MAP  # dict name->no\nmatch = [k for k in INDUSTRY_MAP if \"software\" in k.lower()]\nq = FinvizEquityScreenerQueryParams(industry=match[0])","handlingStrategy":"validation","validationCode":"from openbb_finviz.utils.reference_data import INDUSTRY_MAP\n\nif industry is not None and industry not in INDUSTRY_MAP:\n    candidates = [k for k in INDUSTRY_MAP if industry.lower() in k.lower()]\n    industry = candidates[0] if len(candidates) == 1 else None\nassert industry is None or industry in INDUSTRY_MAP","typeGuard":"def is_valid_industry(v: str | None) -> bool:\n    return v is None or v in INDUSTRY_MAP","tryCatchPattern":"from openbb_core.app.model.obb_error import OpenBBError\n\ntry:\n    q = FinvizEquityScreenerQueryParams(industry=industry)\nexcept OpenBBError as e:\n    raise ValueError(f\"Fix industry selection: {e}\") from e","preventionTips":["Use Finviz's granular industry names, not GICS/Yahoo sectors","Populate dropdowns from INDUSTRY_MAP so users cannot type invalid values","Re-validate stored industry strings after upgrading the provider"],"tags":["openbb","finviz","validation","screener","industry"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}