{"record":{"id":"04fee461e690ca0b","repo":"OpenBB-finance/OpenBB","slug":"invalid-country-country-must-be-one-of-list-c","errorCode":null,"errorMessage":"Invalid country, {country}, must be one of {list(COUNTRIES_DICT)}","messagePattern":"Invalid country, (.+?), must be one of (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py","lineNumber":51,"sourceCode":"    )\n    use_cache: bool = Field(\n        default=True,\n        description=\"If true, cache the request for four hours.\",\n    )\n\n    @field_validator(\"country\", mode=\"before\", check_fields=False)\n    @classmethod\n    def validate_country(cls, v) -> str:\n        \"\"\"Validate the country.\"\"\"\n        if v is None:\n            return \"united_states\"\n\n        countries = v.split(\",\")\n        new_countries: list = []\n\n        for country in countries:\n            if country not in COUNTRIES_DICT:\n                raise ValueError(\n                    f\"Invalid country, {country}, must be one of {list(COUNTRIES_DICT)}\"\n                )\n            new_countries.append(country)\n\n        return \",\".join(new_countries)\n\n\nclass EconDbYieldCurveData(YieldCurveData):\n    \"\"\"EconDB Yield Curve Data.\"\"\"\n\n\nclass EconDbYieldCurveFetcher(\n    Fetcher[EconDbYieldCurveQueryParams, list[EconDbYieldCurveData]]\n):\n    \"\"\"EconDB Yield Curve Fetcher.\"\"\"\n\n    require_credentials = False\n","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/econdb/openbb_econdb/models/yield_curve.py#L33-L69","documentation":"EconDbYieldCurveQueryParams.validate_country raises ValueError for any comma-separated country token not present in COUNTRIES_DICT (the provider's supported yield-curve countries). Validation runs at query construction, so the error surfaces before any network call; the message lists all accepted values.","triggerScenarios":"economy.yield_curve(provider='econdb', country='usa'/'US'/'japan') — the dict keys are specific identifiers (e.g. 'united_states'); any other spelling is rejected.","commonSituations":"Using ISO codes or display names from other providers; typo; assuming case-insensitivity (the check is exact).","solutions":["Read the accepted values from the error message and use one exactly (e.g. 'united_states').","Query only countries you know EconDB publishes yield curves for (a small set — the message enumerates it).","For multiple countries pass a comma-joined string of valid keys: 'united_states,japan'-style values drawn from the listed set."],"exampleFix":"# before\nobb.economy.yield_curve(provider='econdb', country='US')\n\n# after\nobb.economy.yield_curve(provider='econdb', country='united_states')","handlingStrategy":"validation","validationCode":"from openbb_econdb.models.yield_curve import COUNTRIES_DICT\nrequested = ['united_states', 'japan']\ninvalid = [c for c in requested if c not in COUNTRIES_DICT]\nif invalid:\n    raise ValueError(f'econdb yield curve supports only {list(COUNTRIES_DICT)}; got {invalid}')","typeGuard":"def is_supported_yield_country(c: str) -> bool:\n    from openbb_econdb.models.yield_curve import COUNTRIES_DICT\n    return c in COUNTRIES_DICT","tryCatchPattern":"try:\n    res = obb.economy.yield_curve(provider='econdb', country=country)\nexcept Exception as e:\n    if 'must be one of' in str(e):\n        country = 'united_states'\n        res = obb.economy.yield_curve(provider='econdb', country=country)\n    else:\n        raise","preventionTips":["Use the exact dict keys ('united_states', not 'US'/'USA').","Validate against COUNTRIES_DICT before calling.","Note validation is exact-match, case-sensitive."],"tags":["validation","country-codes","yield-curve","econdb"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}