OpenBB-finance/OpenBB · error · OpenBBError

Invalid transform value '{query.transform}' for dataflow '{d

Error message

Invalid transform value '{query.transform}' for dataflow '{dataflow}'. Available options: {', '.join(available) if available else 'none'}

What it means

Raised by the IMF economic_indicators fetcher when the caller supplies a `transform` value that the requested SDMX dataflow does not expose as a valid TRANSFORM (or UNIT) dimension value. The fetcher inspects the dataflow's dimension codelists and, before querying, verifies that the requested transform maps onto an actual dimension code; if not, it aborts with the list of transforms/units the dataflow actually accepts (or 'none'). This is a fail-fast validation so the IMF API does not silently ignore the transform.

Source

Thrown at openbb_platform/providers/imf/openbb_imf/models/economic_indicators.py:773

                # Raise error if transform value is not valid for dataflow
                if not applied:
                    available = []
                    if transform_lookup:
                        available.extend(
                            sorted(
                                set(transform_lookup.keys())
                                - set(transform_lookup.values())
                            )
                        )
                    if unit_lookup:
                        available.extend(
                            sorted(set(unit_lookup.keys()) - set(unit_lookup.values()))
                        )
                    if not transform_dim and not unit_dim:
                        raise OpenBBError(
                            f"Dataflow '{dataflow}' does not support transform/unit parameter."
                        )
                    raise OpenBBError(
                        f"Invalid transform value '{query.transform}' for dataflow '{dataflow}'. "
                        f"Available options: {', '.join(available) if available else 'none'}"
                    )

            # We request one extra period to ensure value carry-forward for STATUS="NA" obs.
            if query.limit is not None and start_date is None:
                current_year = datetime.now().year
                if frequency == "A":
                    start_year = current_year - query.limit - 1
                    start_date = str(start_year)  # Just year for annual
                elif frequency == "Q":
                    years_back = (query.limit + 7) // 4 + 1
                    start_year = current_year - years_back
                    start_date = str(start_year)
                elif frequency == "M":
                    years_back = (query.limit + 23) // 12 + 1
                    start_year = current_year - years_back
                    start_date = str(start_year)

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Read the error message: use one of the transforms listed after 'Available options:' for that exact dataflow.
  2. Drop the `transform` parameter entirely to fetch raw values for that dataflow.
  3. Check the dataflow's codelist via the IMF SDMX structure endpoint or the provider's `transform_lookup` to confirm supported codes before calling.
  4. If you need a specific transform (e.g. year-over-year), compute it from the raw series locally instead.

Example fix

# before
economic_indicators(indicator='NGDP_RPCH', transform='growth')

# after
economic_indicators(indicator='NGDP_RPCH')  # transform unsupported; use listed options only
Defensive patterns

Strategy: validation

Validate before calling

from openbb_imf.models.economic_indicators import get_transform_options  # if exposed; else query structure first
# Generic pre-check: fetch the dataflow structure and confirm the transform code exists
async def transform_supported(dataflow: str, transform: str) -> bool:
    # inspect the provider's transform_lookup for the dataflow, or call the IMF
    # SDMX structure endpoint and look for TRANSFORM codelist membership
    codes = await fetch_transform_codelist(dataflow)  # your helper
    return transform in codes

Try / catch

try:
    res = await obb.economy.imf.economic_indicators(indicator=ind, transform=t)
except OpenBBError as e:
    if 'Invalid transform value' in str(e):
        res = await obb.economy.imf.economic_indicators(indicator=ind)  # retry raw
    else:
        raise

Prevention

When it happens

Trigger: Calling `economic_indicators(..., transform='pcp')` (or any transform string) with `indicator`/`table` set to a dataflow whose SDMX structure has no TRANSFORM dimension, or whose codelist lacks the given code. Only hit in the single-dataflow code path (table mode or one indicator) where transform_dim/unit_dim lookup fails and `available` is populated.

Common situations: Copy-pasting a transform (e.g. 'yoy', 'pcp') that worked for one IMF dataflow (like the IFS main tables) onto another dataflow with a different structure; upgrading the provider after IMF renames codelist codes; passing a unit string in the `transform` parameter.

Related errors


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