{"record":{"id":"7afc4211eb03a11f","repo":"OpenBB-finance/OpenBB","slug":"please-provide-either-an-index-or-a-country","errorCode":null,"errorMessage":"Please provide either an index or a country.","messagePattern":"Please provide either an index or a country\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"openbb_platform/providers/famafrench/openbb_famafrench/utils/helpers.py","lineNumber":531,"sourceCode":"\n\ndef get_international_portfolio_data(\n    index: str | None = None,\n    country: str | None = None,\n    dividends: bool = True,\n) -> str:\n    \"\"\"Download and extract the international index or country portfolio data.\n\n    Note: Not intended for direct use, this function is called by `get_international_portfolio`.\n    \"\"\"\n    # pylint: disable=import-outside-toplevel\n    import zipfile\n    from io import BytesIO\n\n    url: str = \"\"\n    data: str = \"\"\n    if not index and not country:\n        raise ValueError(\"Please provide either an index or a country.\")\n    if index and country:\n        raise ValueError(\n            \"Please provide either an index or a country, not both at the same time.\"\n        )\n    if index:\n        index = INTERNATIONAL_INDEX_PORTFOLIO_FILES.get(index)\n\n        if not index:\n            raise ValueError(\n                f\"Index {index} not found in available indexes: \"\n                + f\"{INTERNATIONAL_INDEX_PORTFOLIO_FILES}\"\n            )\n        url = (\n            BASE_URL\n            + INTERNATIONAL_INDEX_PORTFOLIOS_URLS[\"dividends\" if dividends else \"ex\"]\n        )\n    if country:\n        country = country.title().replace(\"_\", \" \")","sourceCodeStart":513,"sourceCodeEnd":549,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/providers/famafrench/openbb_famafrench/utils/helpers.py#L513-L549","documentation":"Raised inside get_international_portfolio_data when both `index` and `country` are falsy. The international portfolios dataset is keyed by either a market index or a single country, and the helper refuses to guess which file to download.","triggerScenarios":"Calling international index/country returns with neither index nor country set (both None or empty strings).","commonSituations":"Building query params dynamically and both fields end up empty; passing an empty string instead of None; assuming the model has a default portfolio.","solutions":["Pass exactly one of index or country, e.g. index='Developed' or country='Japan'.","Check the endpoint's parameter choices (INTERNATIONAL_INDEX_PORTFOLIO_FILES / COUNTRY_PORTFOLIO_FILES) for valid values.","Guard upstream code so at least one parameter is always provided."],"exampleFix":"// before\nobb.economy.famafrench.international_index_returns(country=None, index=None)\n\n// after\nobb.economy.famafrench.international_index_returns(country='Japan')","handlingStrategy":"validation","validationCode":"if not index and not country:\n    raise ValueError('Provide index or country before calling famafrench international returns')","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Make one of index/country required in your own wrapper signature.","Reject empty strings, not just None, since falsy strings also trigger the error."],"tags":["famafrench","validation","required-parameter"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}