{"record":{"id":"13cbbcb6258b2557","repo":"OpenBB-finance/OpenBB","slug":"invalid-section-key-val-choose-one-of-the","errorCode":null,"errorMessage":"Invalid [{section}] {key}={val}. Choose one of the following options:\n{', '.join(d_check_screener[key])}.\n","messagePattern":"Invalid \\[(.+?)\\] (.+?)=(.+?)\\. Choose one of the following options:\n(.+?)\\.\n","errorType":"exception","errorClass":"OpenBBError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py","lineNumber":623,"sourceCode":"        if preset is not None:\n            preset_filter = configparser.RawConfigParser()\n            preset_filter.optionxform = str  # type: ignore\n            preset_filter.read(preset_choices[preset])\n            d_general = preset_filter[\"General\"]\n            d_filters = {\n                **preset_filter[\"Descriptive\"],\n                **preset_filter[\"Fundamental\"],\n                **preset_filter[\"Technical\"],\n            }\n            for section in [\"General\", \"Descriptive\", \"Fundamental\", \"Technical\"]:\n                for key, val in {**preset_filter[section]}.items():\n                    if key not in d_check_screener:\n                        raise OpenBBError(\n                            f\"The screener variable {section}.{key} shouldn't exist!\\n\"\n                        )\n\n                    if val not in d_check_screener[key]:\n                        raise OpenBBError(\n                            f\"Invalid [{section}] {key}={val}. \"\n                            f\"Choose one of the following options:\\n{', '.join(d_check_screener[key])}.\\n\"\n                        )\n\n            d_filters = {k: v for k, v in d_filters.items() if v is not None}\n            screen.set_filter(filters_dict=d_filters)\n            asc = None\n\n            asc = d_general.get(\"Ascend\")\n\n            if asc is not None:\n                ascend = asc == \"true\"\n\n            df_screen = screen.screener_view(\n                order=d_general.get(\"Order\", \"Change\"),\n                limit=limit if limit else 100000,\n                ascend=ascend,\n                sleep_sec=sleep,","sourceCodeStart":605,"sourceCodeEnd":641,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/finviz/openbb_finviz/models/equity_screener.py#L605-L641","documentation":"A preset INI key was recognized, but its value is not in the allowed option set for that filter (d_check_screener[key]). The message lists every legal value for that key. Finviz filters are enumerated choices, not free-form numbers or booleans.","triggerScenarios":"Setting P/E = 10 (raw number) instead of a bucket like 'Over 10'; 'Ascend = yes' instead of 'true'; country codes or exchange values not in the enumeration.","commonSituations":"Users writing natural numeric values where Finviz expects range buckets; template edits that change only the value but keep wrong syntax; locale differences ('true' vs 'True' vs 'yes').","solutions":["Replace the value with one of the options listed in the error message for that key","Copy value syntax verbatim from the shipped screener_template.ini","For numeric concepts, choose the closest bucket (e.g. 'Over 10', 'Under 5') rather than a raw number"],"exampleFix":"; before\n[Fundamental]\nP/E = 12.5        ; raw number -> Invalid [Fundamental] P/E=12.5\n\n; after\n[Fundamental]\nP/E = Over 10","handlingStrategy":"validation","validationCode":"import configparser\n\ndef validate_values(ini_path: str, allowed: dict[str, set[str]]) -> list[str]:\n    c = configparser.RawConfigParser(); c.optionxform = str; c.read(ini_path)\n    bad = []\n    for s in c.sections():\n        for k, v in c[s].items():\n            if k in allowed and v not in allowed[k]:\n                bad.append(f\"[{s}] {k}={v}\")\n    return bad","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use Finviz's enumerated bucket values verbatim, not raw numbers","Copy value syntax from the shipped template","Use 'true'/'false' (lowercase) for boolean keys like Ascend"],"tags":["openbb","finviz","preset","ini","validation"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}