def _check_start(
    series: TimeSeries,
    start_idx: int,
    start: Union[pd.Timestamp, int, float],
    start_format: Literal["value", "position"],
    series_start: Union[pd.Timestamp, int],
    ref_start: Union[pd.Timestamp, int],
    ref_end: Union[pd.Timestamp, int],
    stride: int,
    series_idx: int,
    is_historical_forecast: bool,
):
    """Raises an error if the start index (position) is not within the series."""
    if start_idx < len(series):
        return

    if start_format == "position" or (
        not isinstance(start, pd.Timestamp) and series._has_datetime_index
    ):
        start_format_msg = f"position `{start}` corresponding to time "
        if isinstance(start, float):
            # fraction of series
            start = series.get_index_at_point(start)
        elif start >= 0:
            # start >= 0 is relative to the start
            start = series.start_time() + start * series.freq
        else:
            # start < 0 is relative to the end
            start = series.end_time() + (start + 1) * series.freq
    else:
        start_format_msg = "time "
    ref_msg = "" if not is_historical_forecast else "historical forecastable "
    start_new = series_start + start_idx * series.freq
    raise_log(
        ValueError(
            f"`start` {start_format_msg}`{start}` is smaller than the first {ref_msg}time index "
            f"`{ref_start}` for series at index: {series_idx}, and could not find a valid start "
            f"point within the {ref_msg}time index that lies a round-multiple of `stride={stride}` "
            f"ahead of `start` (first inferred start is `{start_new}`, but last {ref_msg}time index "
            f"is `{ref_end}`."
        ),
        logger=logger,
    )
Raises an error if the start index (position) is not within the series.
darts/utils/historical_forecasts/utils.py