OpenBB-finance/OpenBB · error · ValueError

Invalid attribute(s) '{invalid_attrs}'. Valid attributes are

Error message

Invalid attribute(s) '{invalid_attrs}'. Valid attributes are: {valid_attributes}

What it means

Error "Invalid attribute(s) '{invalid_attrs}'. Valid attributes are: {valid_attributes}" thrown in OpenBB-finance/OpenBB.

Source

Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:253

                [attributes] if "," not in attributes else attributes.split(",")
            )

        if (
            isinstance(attributes, list)
            and len(attributes) == 1
            and "," in attributes[0]
        ):
            attributes = attributes[0].split(",")

        if not isinstance(attributes, list):
            raise ValueError(
                f"Attribute must be a string or list of strings. Got {type(v)}"
            )

        invalid_attrs = [attr for attr in attributes if attr not in ATTRIBUTES]

        if invalid_attrs:
            raise ValueError(
                f"Invalid attribute(s) '{', '.join(invalid_attrs)}'. Valid attributes are: "
                + ", ".join(sorted(list(ATTRIBUTES)))
            )

        return attributes

    @field_validator("country", mode="before", check_fields=False)
    @classmethod
    def _validate_country(cls, v):
        """Validate country."""
        if not v:
            return None

        if v and isinstance(v, list) and not v[0]:
            return None

        countries = v

View on GitHub (pinned to 3e071fcc2c)

Solutions

  1. Choose attributes from the listed valid attributes.
  2. Check spelling of the attribute names.

When it happens

Trigger: Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:253 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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