microsoft/qlib · error · NotImplementedError

This type of input is not supported

Error message

This type of input is not supported

What it means

Raised by CalendarProvider.align_idx when tp_type is neither 'start' nor 'end'. The method maps a timestamp to a calendar index via bisect on self.cals; any other tp_type string is unsupported.

Source

Thrown at qlib/workflow/task/utils.py:141

        Parameters
        ----------
        time_point
        tp_type : str

        Returns
        -------
        index : int
        """
        if time_point is None:
            # `None` indicates unbounded index/boarder
            return None
        time_point = pd.Timestamp(time_point)
        if tp_type == "start":
            idx = bisect.bisect_left(self.cals, time_point)
        elif tp_type == "end":
            idx = bisect.bisect_right(self.cals, time_point) - 1
        else:
            raise NotImplementedError(f"This type of input is not supported")
        return idx

    def cal_interval(self, time_point_A, time_point_B) -> int:
        """
        Calculate the trading day interval (time_point_A - time_point_B)

        Args:
            time_point_A : time_point_A
            time_point_B : time_point_B (is the past of time_point_A)

        Returns:
            int: the interval between A and B
        """
        return self.align_idx(time_point_A) - self.align_idx(time_point_B)

    def align_time(self, time_point, tp_type="start") -> pd.Timestamp:
        """
        Align time_point to trade date of calendar

View on GitHub (pinned to 79633dd950)

Solutions

  1. Use only tp_type='start' or tp_type='end'.
  2. Prefer the public wrappers align_time/align_seg/shift which set tp_type correctly instead of calling align_idx directly.

Example fix

// before
idx = cal.align_idx(ts, tp_type="begin")

// after
idx = cal.align_idx(ts, tp_type="start")
Defensive patterns

Strategy: validation

Validate before calling

assert tp_type in ("start", "end"), f"tp_type must be start/end, got {tp_type}"

Prevention

When it happens

Trigger: Calling align_time/align_idx (or code inside TaskGen that calls it) with tp_type='middle', tp_type=None, or a typo like 'Start' instead of 'start'.

Common situations: Custom dataset/task generator code that copies align_time but passes a different third positional/keyword argument; subclassing and overriding shift/align helpers with an extra rtype value that leaks into tp_type.

Related errors


AI-assisted analysis of microsoft/qlib@79633dd950 (2026-08-15). Data as JSON: /api/errors/54f7621f4b875f12. Report an issue: GitHub.