OpenBB-finance/OpenBB · error · RuntimeError

This charting method does not support

Error message

This charting method does not support {provider}. Supported providers: imf.

What it means

The maritime chokepoint info chart (economy_shipping_chokepoint_info) is provider-specific: it delegates rendering to openbb_imf.views.maritime_chokepoint_info, which only understands IMF-SDB response shapes. If the provider attached to the data is not 'imf', it raises RuntimeError immediately instead of attempting to plot foreign data.

Solutions

  1. Request the data with provider='imf': obb.economy.shipping.chokepoint_info(provider='imf').
  2. For other providers, extract the results (res.to_df()) and build the figure with the generic charting API.

Example fix

# before
res = obb.economy.shipping.chokepoint_info(provider='custom').charting.to_chart()

# after
res = obb.economy.shipping.chokepoint_info(provider='imf')
fig, content = res.charting.to_chart()
Defensive patterns

Strategy: validation

Validate before calling

assert kwargs.get('provider', 'imf') == 'imf', (
    'chokepoint chart requires provider="imf"'
)

Try / catch

try:
    fig, content = views.economy_shipping_chokepoint_info(**kwargs)
except RuntimeError as e:
    if 'does not support' in str(e) and 'imf' in str(e):
        kwargs['provider'] = 'imf'  # refetch with imf, then retry
    else:
        raise

Prevention

When it happens

Trigger: Calling obb.economy.shipping.chokepoint_info(...).charting.to_chart() (or the view directly) with a non-IMF provider, or with provider unset/None while injecting external data.

Common situations: Fetching chokepoint data from an alternative provider then applying the default charting route, or writing a custom integration that bypasses the IMF fetcher.

Related errors


AI-assisted analysis of OpenBB-finance/OpenBB@3e071fcc2c (2026-08-14). Data as JSON: /api/errors/0f1489264e237f93. Report an issue: GitHub.

Appendix: source

Thrown at openbb_platform/extensions/economy/openbb_economy/economy_views.py:528

                x=0,
                font=dict(size=12),
            ),
        )
        content = fig.to_plotly_json()

        return fig, content  # type: ignore

    @staticmethod
    def economy_shipping_chokepoint_info(
        **kwargs,
    ) -> tuple["OpenBBFigure", dict[str, Any]]:
        """Maritime Chokepoint Info Chart."""
        # pylint: disable=import-outside-toplevel

        provider = kwargs.get("provider")

        if provider != "imf":
            raise RuntimeError(
                f"This charting method does not support {provider}. Supported providers: imf."
            )

        try:
            from openbb_imf.views.maritime_chokepoint_info import (
                plot_chokepoint_annual_avg_vessels,
            )
        except Exception as e:
            raise RuntimeError("Unable to import the required module.") from e

        theme = (
            kwargs.get("extra_params", {}).get("theme")
            or kwargs.get("theme")
            or getattr(kwargs["charting_settings"], "chart_style", "dark")
        )
        data = (
            kwargs.pop("data", None)
            if "data" in kwargs and kwargs["data"] is not None

View on GitHub (pinned to 3e071fcc2c)