pathwaycom/pathway · error · ValueError

Cannot provide both [duration, ratio] at the same time.

Error message

Cannot provide both [duration, ratio] at the same time.

What it means

Error "Cannot provide both [duration, ratio] at the same time." thrown in pathwaycom/pathway.

Source

Thrown at python/pathway/stdlib/temporal/_window.py:629

    ...   count=pw.reducers.count(),
    ... )
    >>> pw.debug.compute_and_print(result, include_id=False)
    _pw_instance | _pw_window_start | _pw_window_end | min_t | max_t | count
    0            | 3                | 13             | 12    | 12    | 1
    0            | 6                | 16             | 12    | 15    | 4
    0            | 9                | 19             | 12    | 17    | 6
    0            | 12               | 22             | 12    | 17    | 6
    0            | 15               | 25             | 15    | 17    | 3
    1            | 3                | 13             | 10    | 11    | 2
    1            | 6                | 16             | 10    | 11    | 2
    1            | 9                | 19             | 10    | 11    | 2
    """
    if duration is None and ratio is None:
        raise ValueError(
            "At least one of the parameters [duration, ratio] should be provided."
        )
    elif duration is not None and ratio is not None:
        raise ValueError("Cannot provide both [duration, ratio] at the same time.")

    return _SlidingWindow(
        duration=duration,
        hop=hop,
        ratio=ratio,
        origin=origin,
    )


@check_arg_types
@trace_user_frame
def tumbling(
    duration: int | float | datetime.timedelta,
    origin: int | float | datetime.datetime | None = None,
) -> Window:
    """Allows grouping together elements within a window of a given length tumbling
    across ordered time-like data column starting from a given origin.

View on GitHub (pinned to fa2f74a464)

Solutions

  1. Provide only one of duration or ratio, not both.

Example fix

pw.temporal.sliding(duration=timedelta(hours=1))

When it happens

Trigger: Thrown at python/pathway/stdlib/temporal/_window.py:629 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pathwaycom/pathway@fa2f74a464 (2026-08-15). Data as JSON: /api/errors/08ff6b53d9337f50. Report an issue: GitHub.