OpenBB-finance/OpenBB · error · OpenBBError
Error serializing output for an extension-modified endpoint
Error message
Error serializing output for an extension-modified endpoint {path}: {exc} What it means
Raised in the CPI fetcher's `transform_data` when the IMF API responded but contained no observation rows (`row_data` empty). Unlike the validator errors, this happens after a successful network round-trip: the query was syntactically valid but the IMF SDMX endpoint returned no data points. Wrapped in `OpenBBError`, so it surfaces as a hard error rather than an empty-data signal.
Source
Thrown at openbb_platform/core/openbb_core/api/router/commands.py:333
exclude_unset=True, exclude_none=True
).get("results", [])
return JSONResponse(
content=jsonable_encoder(content), status_code=200
)
if (mutated_output and isinstance(output, OBBject)) or (
isinstance(output, OBBject) and no_validate
):
output.results = output.model_dump(
exclude_unset=True, exclude_none=True
).get("results")
return JSONResponse(
content=jsonable_encoder(output), status_code=200
)
except Exception as exc: # pylint: disable=W0703
raise OpenBBError(
f"Error serializing output for an extension-modified endpoint {path}: {exc}",
) from exc
if not no_validate:
return validate_output(output)
return output
return wrapper
def add_command_map(command_runner: CommandRunner, api_router: APIRouter) -> None:
"""Add command map to the API router."""
plugins_router = RouterLoader.from_extensions()
for route in plugins_router.api_router.routes:
route.endpoint = build_api_wrapper(command_runner=command_runner, route=route) # type: ignore # noqa
api_router.include_router(router=plugins_router.api_router)View on GitHub (pinned to 3e071fcc2c)
Solutions
- Widen or shift the date range to the country's actual publication window (CPI data typically starts mid-20th century).
- Try the alternate index type — some countries publish HICP only (or CPI only).
- Retry once after a short delay to rule out a transient empty IMF response.
- Catch `OpenBBError` and check for 'No data returned' if your pipeline should degrade to empty instead of failing.
Example fix
# before res = obb.economy.cpi(provider='imf', country='USA', start_date='1900-01-01', end_date='1910-01-01') # after res = obb.economy.cpi(provider='imf', country='USA', start_date='2000-01-01', end_date='2024-12-31')
Defensive patterns
Strategy: try-catch
Try / catch
from openbb_core.app.model.abstract.error import OpenBBError
try:
res = obb.economy.cpi(provider='imf', country=c, expenditure=exp, start_date=sd, end_date=ed)
except OpenBBError as e:
if 'No data returned' in str(e):
res = None # coverage gap or empty IMF response; widen dates or try alternate index type
else:
raise Prevention
- Anchor date windows to each country's known CPI publication history rather than fixed global ranges.
- In batch pipelines, catch OpenBBError and degrade the country to 'skipped — no data' instead of aborting.
- Retry once before concluding coverage is missing; IMF occasionally returns transient empty payloads.
When it happens
Trigger: Requesting a date range entirely outside the country's CPI coverage (e.g. `start_date='1900-01-01'` where data starts in 1960); a country/indicator combination that exists in the mapping but has no published observations; IMF returning an empty dataset during publication lag for the current period.
Common situations: Very old or very recent date windows; newly added CPI countries with no data yet; IMF API intermittent empty responses; index_type selections (CPI vs HICP) where the country only publishes one of them.
Related errors
- At least one extension type must be selected.
- Incorrect email or password
- OBBject Extension Error -> An OBBject extension that acts
- No data found for the specified port(s). {port_codes} Ensure
- Failed to get Jupyter URL
AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14).
Data as JSON: /api/errors/47e0ef97e55b7094.
Report an issue: GitHub.