OpenBB-finance/OpenBB · error · ValueError

Earliest possible year is 1960.

Error message

Earliest possible year is 1960.

What it means

Error "Earliest possible year is 1960." thrown in OpenBB-finance/OpenBB.

Solutions

  1. Set start year to 1960 or later.
  2. Adjust the year range to fall within available PSD data coverage.

When it happens

Trigger: Thrown at openbb_platform/providers/government_us/openbb_government_us/models/commodity_psd_data.py:306 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/be75126e769ba553. Report an issue: GitHub.

Appendix: source

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

            and country not in COUNTRY_CHOICES
        ]

        if invalid_countries:
            raise ValueError(
                f"Invalid country code(s) '{', '.join(invalid_countries)}'. Valid country codes are: "
                + ", ".join(
                    sorted(list(COUNTRY_CHOICES)),
                )
            )

        return v

    @field_validator("start_year", mode="before", check_fields=False)
    @classmethod
    def _validate_start_year(cls, v):
        """Validate start_year."""
        if v and v < 1960:
            raise ValueError("Earliest possible year is 1960.")
        return v

    @model_validator(mode="after")
    def _validate_model(self):
        """Validate that start_year is less than or equal to end_year."""
        report_id = getattr(self, "report_id", None)
        commodity = getattr(self, "commodity", None)

        if not report_id and not commodity:
            raise ValueError(
                "Either 'report_id' or 'commodity' must be provided."
                + " If both are provided, 'commodity' takes precedence."
            )

        return self


class GovernmentUsCommodityPsdData(CommodityPsdData):

View on GitHub (pinned to 3e071fcc2c)