{"record":{"id":"47467cfba8f1c229","repo":"pathwaycom/pathway","slug":"cannot-provide-both-predicate-max-gap-at-the-sa","errorCode":null,"errorMessage":"Cannot provide both [predicate, max_gap] at the same time.","messagePattern":"Cannot provide both \\[predicate, max_gap\\] at the same time\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/pathway/stdlib/temporal/_window.py","lineNumber":559,"sourceCode":"    ... pw.this._pw_window_start,\n    ... pw.this._pw_window_end,\n    ... min_t=pw.reducers.min(pw.this.t),\n    ... max_v=pw.reducers.max(pw.this.v),\n    ... count=pw.reducers.count(),\n    ... )\n    >>> pw.debug.compute_and_print(result, include_id=False)\n    _pw_instance | _pw_window_start | _pw_window_end | min_t | max_v | count\n    0            | 1                | 2              | 1     | 10    | 2\n    0            | 4                | 4              | 4     | 3     | 1\n    0            | 8                | 10             | 8     | 8     | 3\n    1            | 1                | 2              | 1     | 16    | 2\n    \"\"\"\n    if predicate is None and max_gap is None:\n        raise ValueError(\n            \"At least one of the parameters [predicate, max_gap] should be provided.\"\n        )\n    elif predicate is not None and max_gap is not None:\n        raise ValueError(\"Cannot provide both [predicate, max_gap] at the same time.\")\n    return _SessionWindow(predicate=predicate, max_gap=max_gap)\n\n\n@check_arg_types\n@trace_user_frame\ndef sliding(\n    hop: int | float | datetime.timedelta,\n    duration: int | float | datetime.timedelta | None = None,\n    ratio: int | None = None,\n    origin: int | float | datetime.datetime | None = None,\n) -> Window:\n    \"\"\"Allows grouping together elements within a window of a given length sliding\n    across ordered time-like data column according to a specified interval (hop)\n    starting from a given origin.\n\n    Note:\n        Usually used as an argument of `.windowby()`.\n        Exactly one of the arguments `hop` or `ratio` should be provided.","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/pathwaycom/pathway/blob/fa2f74a4649b7c5908690cf60137263d8d80de5f/python/pathway/stdlib/temporal/_window.py#L541-L577","documentation":"Error \"Cannot provide both [predicate, max_gap] at the same time.\" thrown in pathwaycom/pathway.","triggerScenarios":"Thrown at python/pathway/stdlib/temporal/_window.py:559 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide only one of predicate or max_gap, not both."],"exampleFix":"pw.temporal.sessionby(max_gap=timedelta(minutes=5))","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"fa2f74a4649b7c5908690cf60137263d8d80de5f","analyzedAt":"2026-08-15T01:48:17.006Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}